Results 1 to 1 of 1
Hello,
I am trying to write simple driver for usb wlan adapter using libusb. I configured the device like this:
int usbdev_init()
{
struct usb_device *usb_dev;
int ret;
usb_dev = ...
- 08-09-2007 #1Just Joined!
- Join Date
- Dec 2006
- Posts
- 26
wlan driver using libusb
Hello,
I am trying to write simple driver for usb wlan adapter using libusb. I configured the device like this:
int usbdev_init()
{
struct usb_device *usb_dev;
int ret;
usb_dev = device_init();
if (usb_dev == NULL) {
fprintf(stderr, "Device not found\n");
return ret;
}
else {
printf("Device found: %04X-%04X\n", usb_dev->descriptor.idVendor,
usb_dev->descriptor.idProduct);
}
usb_handle = usb_open(usb_dev);
if (usb_handle == NULL) {
fprintf(stderr,
"Not able to claim the USB device\n");
return ret;
}
ret = usb_set_configuration(usb_handle, 1);
printf("usb_set_configuration: returned: %i\n", ret);
if(ret < 0)return ret;
ret = usb_claim_interface(usb_handle, 0);
printf("usb_claim_interface: returned: %i\n", ret);
if(ret < 0)return ret;
return ret;
}
My problem is, that when I create a 802.11 frame (I tried beacon and probe request in ad-hoc mode) and call usb_bulk_write, function returns number of successfully sent bytes(length of frame, that has been sent). But the device actually doesn't send any data. I tried to capture frames by AirMagnet and no frames has been captured.
When I configure my laptop WLAN to ad-hoc mode, it starts sending beacons. But calling usb_bulk_read and usb_interrupt_read on PC doesn't read any data. Under windows with original driver the device works correctly.
Is it necessary to configure the device another way that I mentioned? I am newbie to programming drivers.
Later I am going to port the driver for embedded device with no OS (I already have working usb stack with same API like libusb on it) so I don't use the structure net_device from linux/netdevice.h. Could it be the problem?
I just create a frame, store it in buffer and call usb_bulk_write(&usb_dev, EP_BULK_OUT, &buffer, frame_length, 100)
Vita


Reply With Quote