Hi,
I would like to read and write informations (just some bytes) with USB.
(For information my device is a pic which works in low speed in interruptb transfer 
but it's not important because the above program send me information from device 
properly.)
That works properly under windows...
And now reading from device is succeful under linus-2.4.20.

I use the file /dev/usb/hiddev0.
Here is the program:

typedef struct {
unsigned hid;
signed int value;
} hiddev_event;

main(){
ssize_t bytesread;
int FILEDES;
hiddev_event *buffer;

buffer=(hiddev_event *)malloc(sizeof(hiddev_event));

FILEDES=open("/dev/usb/hiddev0",O_RDONLY);

bytesread=1;
while(bytesread>0){
  bytesread=read(FILEDES,buffer,sizeof(hiddev_event));
 
  if(bytesread!=sizeof(hiddev_event)){
       exit(1);
    }
   printf("Unknown event bytes=%d hid=%d value=%d\n",
   bytesread,buffer->hid,buffer->value);
}

When I try to write in fd (in order to write to the device) errno return me the value 
22(EINVAL) although I open fd in O_WRONLY or O_RDWR...
Do an other driver exist than HID to communicate PC/DEVICE????

                              B.GIRAUD<[EMAIL PROTECTED]>  


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to