| 
      
      
      From: Prabhu R <ece...@gm...> - 2007-09-07 04:20:48
      
     | 
| Hi Guys,
            I tried to use usb_control_msg() for a vendor specific request,
but its returning -1(failure). I have one of my device connected. My code is
given below.
My values for the parameter are the following,
RequestType - 0xc1 (vendor specific request)
Request        - 0x82
Value            - 0
Index             - 0
buffer             - char data[10]
length            - 10
timeout          - 1000
Please provide a suggestion.
Source Code:
#include <stdio.h>
#include "usb.h"
main()
{
int i;
char data[10];
struct usb_bus *bus;
struct usb_device *device;
struct usb_dev_handle *handle;
usb_init();
i = usb_find_busses();
printf("No of busses found = %d\n", i);
i = usb_find_devices();
printf("No of devices found = %d\n", i);
for(bus = usb_get_busses(); bus; bus = bus->next)
{
for(device = bus->devices; device; device = device->next)
{
printf("Starting to open device.....\n");
handle = usb_open(device);
i = usb_control_msg(handle, 0xc1, 0x82, 0, 0, data, 10, 1000);
printf("Return Value of usb_control_msg() = %d", i);
usb_close(handle);
}
}
getch();
}
Output:
No of busses found = 1
No of devices found = 1
Starting to open device.....
Return Value of usb_control_msg() = -1
 |