I have a problem reading from my hid-device using the hid module. I managed to send commands to the device using the CSREPORT and CSUSAGE, but i cant seem to get the information back from the device.
As i have writen the firmware myself, i know that the device responds to command through endpoint 0 (Control) and sends data back using endpoint 1(INT). The size of endpoint1 is 6byte. But i cant seem to get these 6 bytes (or any) from the hiddev, just report using CGREPORT, with 2byte-size. How do i access the interrupt-transfer ? I tried using the read() as described in hiddev.txt, but it only blocks/timeouts. Is there any documentation/howto/example for reading from the hiddev ? I also looked at the ups.c but couldn't get it to work for me. I searched the net and the mailling-list archive, but didn't find anything useful. Martin the entry in /proc/bus/usb/devices is: T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 7 Spd=1.5 MxCh= 0 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=1234 ProdID=1234 Rev= 0.01 C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=hid E: Ad=81(I) Atr=03(Int.) MxPS= 6 Ivl=10ms and i send a command to the device using : fd=open("/dev/usb/hiddev0",O_RDWR); struct hiddev_usage_ref uref; struct hiddev_report_info rinfo; uref.report_type=HID_REPORT_TYPE_OUTPUT; uref.report_id=HID_REPORT_ID_FIRST; uref.field_index=0; uref.usage_index=0; uref.usage_code=0x01; uref.value=a; ioctl(fd,HIDIOCSUSAGE,&uref) uref.usage_index=1; uref.value=b; ioctl(fd,HIDIOCSUSAGE,&uref) rinfo.report_type=HID_REPORT_TYPE_OUTPUT; rinfo.report_id=HID_REPORT_ID_FIRST; rinfo.num_fields=1; ioctl(fd,HIDIOCSREPORT,&rinfo) and the read I tried: hiddev_event *buffer; read(fd,buffer,sizeof(hiddev_event)); ->timeout or void read_data(fd) { struct hiddev_usage_ref uref; struct hiddev_report_info rinfo; struct hiddev_field_info finfo; struct hiddev_string_descriptor sdesc; static char str[256]; int nret,i; ioctl(fd,HIDIOCINITREPORT,0); rinfo.report_type = HID_REPORT_TYPE_INPUT; rinfo.report_id = HID_REPORT_ID_FIRST ; ioctl( fd, HIDIOCGREPORTINFO, &rinfo); finfo.report_type = rinfo.report_type; finfo.report_id = rinfo.report_id; finfo.field_index = 0; ioctl(fd, HIDIOCGFIELDINFO, &finfo); for (i=0;i<(int)finfo.maxusage;i++) { uref.report_type = finfo.report_type; uref.report_id = finfo.report_id; uref.field_index = 0; uref.usage_index = i; ioctl(fd, HIDIOCGUCODE, &uref); printf("%d = %x\n",uref.value); } } ->nothing useful. ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel