Jump to content

Recommended Posts

Posted

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?

Posted

I solved the same problem for orange pi one a couple of weeks ago. You just need to recompile the kernel with patched hid.c and execute these two lines.

echo 1 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role
echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role

Here is my post.

Posted

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'.

Posted

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

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

Important Information

Terms of Use - Privacy Policy - Guidelines