This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430 USB CDC/HID on Linux

Genius 3020 points

Hello All,

Reading through the documentation the comes along with the MSP430 USB Developers Package, there is an API for HID on the MSP430 and an API for the HID on a windows platform. Is there any sort of support for the HID on Linux?

 

Thanks much,

Barry

  • Linux has its default HID driver - hiddev. But in many cases, HID devices are detached from this default driver, and they are attached to libusb for flexibility.

    Searching on the web, you'll find many wrapper codes to access to HID devices on Java, Python, Ruby, etc.

    For cross-platform, you may like this one.

    HID API for Linux, Mac OS X, and Windows
    http://www.signal11.us/oss/hidapi/

    Tsuneo

  • We successfully communicated with our own MSP430 device that implements a USB HID interface on Ubuntu Linux using the USB API provided by /usr/include/usb.h

    This API comes as standard in Linux, certainly in Ubuntu. The other competitor would be libusb but that is intended for writing kernel USB drivers which is not required here: USB header provides a user level driver to USB.

    One thing you might have problems with is permissions. Linux being what it is does not like the computer user opening a USB device: It will fail unless your Linux application is run as sudo. Also, ensure that you call usb_detach_kernel_driver_np before usb_claim_interface, otherwise the interface claim will fail: This is because when the device is plugged in the Linux kernel already grabs it.

    I have heard that in order to allow the application that accesses USB to run without sudo it is possible to make a script in /etc/udev/rules.d/ (but you cannot edit there until you do a sudo nautilus - brings the File Browser up in sudo mode). I tried this but it still did not allow use without sudo.

    Another thing that I have found and not yet resolved is that the HID Report Descriptor is not available. lsusb also does not list it. I assume it is another stupid Linux permissions thing. The HID Report Descriptor gives you the report ID (among other things) and allows you to build an 'out' endpoint data structure with the report ID from the device descriptor rather than having to hard code a value in your Linux host application.

  • Err..
    /usr/include/usb.h is a header for libusb.
    So, you are working on libusb, too :-)

    It is introduced with libusb-dev package
    Unfortunately, Ubuntu is distributed without this package.
    You'll need "sudo apt-get install libusb-dev" to install it.

    Tsuneo

  • Tsuneo and Rob,

    Thanks very much for the responses. This gives me something to go on. I appreciate it very much.

    Cheers,

    Barry

**Attention** This is a public forum