> >       fd = open("/proc/bus/usb/002/003", O_RDWR);
> 
> It would make your program more flexible if the bus and device numbers
> were passed as command-line arguments instead of being fixed numbers.
> After all, those numbers will change every time you plug in the USB
> device.
Yes you have reason, but I'm just try.

Here is the new code:

int main(){
        struct usbdevfs_bulktransfer bulk;
        struct usbdevfs_ioctl ctrl;
        int fd,ret,interface=0x00;
        static unsigned char dato[4] = {0xFF, 0, 0, 0};
        fd = open("/proc/bus/usb/002/003", O_RDWR);
        if(fd != -1) {
                //bulk.ep = USB_DIR_IN | 1;
                bulk.ep = 1;
                bulk.len = 6;
                bulk.data = &dato;
                bulk.timeout = 1000;
                ioctl(fd, USBDEVFS_CLAIMINTERFACE, &interface);
                perror("ioctl");
                ioctl(fd, USBDEVFS_BULK, &bulk);
                perror("ioctl");
                close(fd);
        }else
                printf("No lo pudo abrir");
        return 0;
} 

But i receive the same thing.
ioctl: Success
ioctl: Invalid argument
syslog
usb 2-2: usbfs: USBDEVFS_BULK failed ep 0x1 len 6 ret -22

A comment.
I send the data 0xFF just for an example. The firmware receive 4 bytes
and then plus every one.
Can the device's firmware be waiting another data or another kind of data?

Thank you.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to