Need Linux USB/HID interface  libraries and the examples in C/C++ or PHP

Posted on 2011-10-08
Last Modified: 2016-05-20
I have a device(FINCH robot) the shows up as a


on ubuntu linux. The device seems work correctly using Java software provided by the device vendor, without any modifition on the Linux/JDK or whatever.

I need to write my own code to drive the device, with either PHP or C/C++.
I had assumed it was simply a USB/Serial device and trying to implement the commands listed at this site:

, apparently with no success, until someone from the vendor told me it is an HID device, not a serial. Their Java code works on top of a C++ HID library, as I was told.

Now I need two things: 1) a quick education on Linux/USB/HID, to the level just being able to understand how to send these simple serial-like commands and received responses (reports in HID).

 2) C/C++ interface libraries on Linux (uBuntu) for HID devices. With sample codes that include  "/dev/usb/hiddev0"  file desciptor, would be most appreciated. In fact I would rather write PHP code; if someone has a Linux/PHP/ HID code, that will be amazing.

Thanks in advance

Question by:zzhang2006
    LVL 11

    Accepted Solution

    These are the steps that I recommend. I'm not a specialist but I've already done some similar thing.

    First, PHP cannot talk with anyone hardware device directly. You need some extension usually build in C/C++ or a client, like Database does.

    Second, to talk with your device, you need to know about the API of your device, like printers do.

    Maybe, The easiest way to send a command to a device attached a USB port on Linux box is using your mapped dev

    To know about your devices run these commands

    modprobe usbserial
    modprobe hid

    Open in new window

    After you certified that your device is listed  you can test some things on it.

    If you can do commands through command line, you can do it with PHP too.

    LVL 39

    Assisted Solution

    libusb could very well be your friend.
    LVL 1

    Author Closing Comment


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now