Re: ioctl
Frederic <[email protected]>
| Newsgroups | gmane.linux.drivers.ipw2100.devel |
|---|---|
| Message-ID | <[email protected]> |
Okay,
It's what I have done so far but still, there is one thing I don't
understand.
Let's assume I add a method like:
static int ipw_get_status(struct net_device *dev, struct iwreq *wreq) {
struct ipw_priv *priv = ieee80211_priv(dev);
mutex_lock(&priv->mutex);
wreq->u.uparam.value = priv->status;
IPW_DEBUG_WX("Get status -> %d\n", wreq->u.param.value);
mutex_unlock(&priv->mutex);
return 0;
}
I also add the ioctl handler:
enum {
IPW_PRIV_SET_POWER = SIOCIWFIRSTPRIV,
IPW_PRIV_GET_POWER,
(...)
IPW_PRIV_GET_STATUS
};
static struct iw_priv_args ipw_priv_args[] = {
{
.cmd = IPW_PRIV_SET_POWER,
.set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
.name = "set_power"},
(...)
{
.cmd = IPW_PRIV_GET_STATUS,
.get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
.name = "get_status"},
};
static iw_handler ipw_priv_handler[] = {
ipw_wx_set_powermode,
(..)
ipw_get_status
};
I can call the method from a user-space process with something like:
int sock;
struct iwreq wrq;
sock = socket(AF_INET, SOCK_DGRAM, 0);
ioctl(sock, SIOCIWFIRSTPRIV + 10, &wrq);
And with debug, I clearly see the output "Get status -> 2"
Nevertheless, I cannot access it through wrq.u.param.value from the
user-space process. why?
Actually, what I don't understand is how arguments are handle,
especially in the case of zero, one or many args.
Can someone explain me the bitmask of the .set_args and .get_args?
Instead of using SIOCIWFIRSTPRIV + 10, is there another way to call the
method?
I am really sorry about all these questions but I cannot figure it out
by myself. I read the LDD book, wireless.h, iwpriv.h, wireless-tools
source (iwlib.h, iwlib.c, iwconfig.c) but it's still "dark" for me :)
Thanks!
Fred.
Pedro Ramalhais wrote:
> Paolo wrote:
>> On Sun, Oct 01, 2006 at 09:27:34PM +0200, Frederic wrote:
>>> I don't understand exactly how it's implemented in the ipw2200 driver.
>>> Indeed, it's not the same!
>> perhaps a look at how it's done in wireless-tools may help?
>>
>> -- paolo
>
> or in wpa_supplicant (see driver_ipw.c)
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV