Author Topic: Error on executing generic_hid.c  (Read 10767 times)

hoveran

  • Member
  • ***
  • Posts: 3
Error on executing generic_hid.c
« on: November 04, 2011, 05:54:35 pm »
Hi,

I am new to USB, when I try to use your generic_hid.c to get some information on my mouse in Ubuntu11.10. I got following information:

---------------exchange_input_and_output_reports_via_interrupt_transfers
submit_bulk_transfer().
need 1 urbs for new transfer with length 2
ioctrl return :-1
Error sending data via interrupt transfer -1
submiturb failed error -1 errno=22
---------------exchange_input_and_output_reports_via_control_transfers
Error sending Input report 0

---------------exchange_feature_reports_via_control_transfers
Error sending Feature report 0

I write some other programs using libusb.so to operate USB device, the ioctl() are all failed as above, anyone can share some information on it?

Thanks,
Hoveran

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Error on executing generic_hid.c
« Reply #1 on: November 04, 2011, 08:23:23 pm »
Windows obtains exclusive access to system keyboards and mice and doesn't allow applications to open a handle to these devices with read or write access. Use DirectInput or raw input to read mouse data. (Do a web search for more info on these.)

You can exchange Feature reports by not requesting read or write access for the handle, but the device must support Feature reports, and mice typically don't.

Jan

hoveran

  • Member
  • ***
  • Posts: 3
Re: Error on executing generic_hid.c
« Reply #2 on: November 04, 2011, 08:35:42 pm »
I tried it on in Linux, doesn't Linux also allow other application to access mouse or keybords?

when it executes ioctl() operation, we got ERRNO =2

(ENOENT           2      /* No such file or directory */ )

do you know what it means?

Thanks,
Hoveran

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Error on executing generic_hid.c
« Reply #3 on: November 04, 2011, 09:45:16 pm »
See the libusb function usb_claim_interface

Jan

hoveran

  • Member
  • ***
  • Posts: 3
Re: Error on executing generic_hid.c
« Reply #4 on: November 04, 2011, 10:15:37 pm »
sorry, may not catch your point.

libusb_claim_interface() is executed successfully.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Error on executing generic_hid.c
« Reply #5 on: November 05, 2011, 12:28:04 pm »
Here is one example. I haven't used it:

http://www.hasanen.com/?p=6

Jan