i.MX6Q: Communiction with a USB device

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6Q: Communiction with a USB device

Jump to solution
1,609 Views
Tarek
Senior Contributor I

Hi All,

I need to connect a proprietary human interface USB device to i.MX6Q Nitrogen board. The device will send key press information and the userspace application running on i.MX6 should receive this information and perform certain functionality.

I would like to know if anyone implemented any similar program and which library was used?

I found that libusb is very useful but the package provided with LTIB is very old. I build this library but it's not working. There is a test example that comes with the library when ran it on  target it's not doing what it should do. In fact it's not doing anything!

Also I tried to build a more recent version of libusb but couldn't satisfy the dependency requirements.


What is the best method for implementing USB device drivers for i.MX6Q?

Thanks

Labels (2)
0 Kudos
1 Solution
805 Views
Tarek
Senior Contributor I

I have installed the libusb package that comes with Yocto  libusb-1.0.9 and that works.

A good introduction to this library in:

http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/

A good example:

c_example_with_libusb-1.0 [ThingyLab]

The only problem is this version doesn't support hotplug. I need to detect the USB connect/disconnect events in my application.

Is there any other mechanism for detecting the USB hotplug events?

View solution in original post

0 Kudos
2 Replies
806 Views
Tarek
Senior Contributor I

I have installed the libusb package that comes with Yocto  libusb-1.0.9 and that works.

A good introduction to this library in:

http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/

A good example:

c_example_with_libusb-1.0 [ThingyLab]

The only problem is this version doesn't support hotplug. I need to detect the USB connect/disconnect events in my application.

Is there any other mechanism for detecting the USB hotplug events?

0 Kudos
805 Views
Tarek
Senior Contributor I

I can't get the plugin functionality working but there is  a workaround.

libusb_interrupt_transfer() blocks until any data is received or if the device is unplugged. So I check the return value is not LIBUSB_SUCCESS then assume the device is disconnected and keep polling libusb_get_device_list() until my device appears again.