Jump to content

nanopi m1 create hid usb gadget


xi-tauw

Recommended Posts

Hello there.

I'm owner of nano pi m1 board. I want use hid usb gadget on this board, but no success.

First I use prebuild image from download section. I fugured out, that the image contains android_usb gadget and it's works (i didn't go deep, but i see, that after some manipulations with files my computer see nano pi as mass storage). Ok, this shows that nanopi board can be used as device. Go next.

I need to load g_hid module, but there is no such module in the default image.

Ok, time to compile custom kernel (with Igor's script this is easy). I included hid usb gadget via menu.

Booting and "modprobe g_hid". Failed. "No such module" turns into "No such device". Hm...

"modprobe -v -v -v g_hid" says that problem is "could not open '/sys/module/g_hid/initstate': No such file or directory". Nothing i can do with this.

Whats next? I read about gadgetfs and configfs. Trying to create new images with this modules.  No luck. Armbian working, usb gadgets - no.

Another try - compile dev kernel, not legacy.

"modprobe libcomposite" works! Oh... There is /sys/kernel/config/usb_gadget here!

May be this time it will be work?

Nope.

Last step of using configfs is "echo [something] > UDC". This [something] must be from /sys/class/udc, but this dir is empty.

On legacy kernel there is sunxi_usb, if i remember correct.

So, what can i do to? Any ideas to activate HID?

Link to comment
Share on other sites

Thanks for attention. I see your post, and do same. But no luck - "no such device".

"modprobe -v -v -v g_hid" says that problem is "could not open '/sys/module/g_hid/initstate': No such file or directory".

I don't know how to create '/sys/module/g_hid/initstate'.

Link to comment
Share on other sites

After several tries it finally works!

Big thanks for qweryt.

 

So full solution:

1) Change hid.c with provided.

2) Set using g_hid to 'y', not 'm' (if 'm' is seted, there will be error "No such device")

3) After boot echo numbers to otg_role

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines