Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

nanopi m1 create hid usb gadget

Featured Replies

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?

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.

  • Author

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

  • Author

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

Qweryt could you please upload kernel for orange pi one with hid.c patched?

Thanks in advance

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.