To avoid relying on the wireless tools I want to get the essid directly
from the device with ioctl, in C
this wouldn’t be a problem, but in Ruby it’s quite different.
The problem is following struct from wireless.h that is used as
input/reply of ioctl:
struct  iw_point
{
 void __user pointer; / Pointer to the data  (in user space) /
 __u16  length;  / number of fields or size in bytes /
 __u16  flags;   / Optional params */
};
The pointer part must be a valid address of a memory area, followed by
the length in bytes,
followed by a flag field. I tried with Array#pack and the bit-struct
gem, but haven’t found a solution yet.
Is there a way to bypass this memory pointer problem?
__u16 length; /* number of fields or size in bytes /
__u16 flags; / Optional params */
};
The pointer part must be a valid address of a memory area, followed by the length in bytes,
followed by a flag field. I tried with Array#pack and the bit-struct gem, but haven’t found a solution yet.
Is there a way to bypass this memory pointer problem?
Christoph,
How are you calling ioctl() ? If you’re using FFI, then googling for
FFI::Pointer should help. If you’re calling it in some other way and are
trying to access the binary data in ruby, does the P specifier in
pack/unpack work?
Now I can check if I can fetch the max. link quality via ioctl too.
Wbr, Christoph
---- On Tue, 22 Sep 2009 16:58:46 -0700 Joel VanderWerf [email protected] wrote ----
Christoph K. wrote:
Hello.
To avoid relying on the wireless tools I want to get the essid
directly from the device with ioctl, in C
this wouldn’t be a problem, but in Ruby it’s quite different.
The problem is following struct from wireless.h that is used as
input/reply of ioctl:
struct iw_point
{
void __user pointer; / Pointer to the data (in user space) /
__u16 length; / number of fields or size in bytes /
__u16 flags; / Optional params */
};
The pointer part must be a valid address of a memory area, followed
by the length in bytes,
followed by a flag field. I tried with Array#pack and the
bit-struct gem, but haven’t found a solution yet.
Is there a way to bypass this memory pointer problem?
Christoph,
How are you calling ioctl() ? If you’re using FFI, then googling for
FFI::Pointer should help. If you’re calling it in some other way and
are
trying to access the binary data in ruby, does the P specifier in
pack/unpack work?
–
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.