USB HID Gadget

14 9216
igorpec replied at Feb 13, 2016 04:17
I think you need at least kernel 4.4 for otg musb and related stuff.

I have already an image of your armbian installed, but i didn´t had the time to go through it.

In the meantime i had success with modifying the g_hid.ko driver. My PC was able to establish a connection with the banana pi and was installing a "HID Device", but during the installation i lost the connection and the banana was frozen.

It's the same behavior as if you load the g_mass_storage module without adding the option "stall=0", but this option is not available for the g_hid module.

It seems to be a problem with the otg-connection, because if i modprobe the g_hid.ko without plugging in the usb cable, the banana keeps working and i can see, that the /dev/hidg0 device is created, but as soon as i plug in the cable, the banana is frozen again.

Maybe someone could give me a hint what could cause this behavior?

Hi Guys,

my Name is Martin. I'm a teammate of Tailon12. At this time we're still in search of a solution to get g_hid working on Banana Pi with Bananian installed.
Checked our kernel. It's the 3.4.108+. So we should be able use g_hid.
Now our major problem is, to get g_hid acting like HID - Keyboard.
After "# modprobe g_hid", without conneting the otg to PC host, we get:
g_hid gadget: HID Gadget, version: 2010/03/16
g_hid gadget: g_hid ready

Banana still working, everthing is ok.

Now, if with connecting the otg to PC, we get:
g_hid gadget: full-speed config #1: HID Gadget
g_hid gagdet: full-speed config #1: HID Gadget

And now the Banana doesn't do anything further. PC is detecting a new USB - Device, but throws an error. Windows Device Manager tells us, that USB device didn't to request. Device Manager doesn't know witch device type nore it's manufacturer or the productId...

After some time Banana tells us about a stall. This behaviour is looping till restarting the Banana with power down.
I think we do not have the wished hid.c compiled. Has anyone the kind of an idea?


Ok, finally we got Kernel 4.4.10-Bananian installed. Now we can use configfs with libcomposite. It seems to be pretty much easier, than our first way.

We have Banana Pi connected to Windows host, started configfs and libcomposite and also created a hid device. Windows host detects the Banana Pi as a keyboard. So far so good. Now we tried sending some key commands about bash with: echo -ne "/x00/x00/x00/x38/x00/x00/x00/x00" > /dev/hidg0
But there is no sign recieved at the texteditor of the host PC.

Any clues what we are doing wrong?


Yeah, we did it!!
At least a got some errors in my report_desc.

Best regards,

MartinKeppler replied at Jun 28, 2016 00:51
Ok, finally we got Kernel 4.4.10-Bananian installed. Now we can use configfs with libcomposite. It s ...

How you did it?

You have to log in before you can reply Login | Sign Up

Points Rules