Hi everyone,

I've been working on a USB project and have run into some issues that I
can't seem to get around.  I'm trying to write a userspace application that
can connect to and talk to all HID devices, including those that fall under
the input framework.  To do so, I've decided to use usbdevfs.  I've managed
to connect to a device and read all it's descriptors, including the HID
class descriptors and the report descriptors.  However, whenever I try to
use a control request to read a report from the device, I get a timeout.

So this leads me to a couple questions.  I've been searching google for
days without any answers.

1) Is there a way to use the hiddev framework or anything like to it access
_all_ HID devices, including keyboards, mice and joysticks?  I think that
usbdevfs is the best way to go about doing what I want to do, but I could
be wrong.

2) Is there any good documentation about using usbdevfs, especially how to
set up interrupt transfers?  I found on this that someone committed a
documentation patch for usbdevfs , but as helpful as it was, it didn't
explain the concept of interrupt tranfsers.

3) Can anyone explain to me why this code segment keeps giving me a timeout
failure?  As far as the USB spec says, all HID devices should respond to a
get_report request from a control transfer.  I think that my syntax is
correct, but I'm probably missing something very simple.  I keep getting a
"usb_control/bulk_msg" timeout.

      //Claim interface 0 above

      int length = 0x60;
      unsigned char* buffer = (unsigned char*)malloc(length);
      usbdevfs_ctrltransfer ctrl;

      ctrl.requesttype = USB_DIR_IN + USB_TYPE_CLASS + USB_RECIP_INTERFACE;
      ctrl.request = USB_REQ_GET_REPORT;
      ctrl.value = (0x01 << 8) + 0;
      ctrl.index = 0;
      ctrl.length = length;
      ctrl.timeout = 5000;
      ctrl.data = buffer;

      int ret=ioctl(fd,USBDEVFS_CONTROL,&ctrl);
      if ((ret == -1) {
            perror("Error in ioctl");
            return -1;
      }


Thanks for any advice you can give.
-Alex



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to