Quantcast
Channel: Active questions tagged kernel-modules - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 1186

Is there a limit to the number of USB gadget can be created with configfs?

$
0
0

OS: Ubuntu 18.04.3
Kernel: 5.3.8


Hi guys :)
I'm trying to create bunch of HID gadgets by using configfs.
It was successful until setting up fourth gadget,
but kernel emits error message during creation of fifth gadget.
Error message was as below.

# 4 successive gadget creation
g_mouse1 : /dev/hidg0
g_mouse2 : /dev/hidg1
g_mouse3 : /dev/hidg2
g_kbd1 : /dev/hidg3
# error occured
mkdir: cannot create directory ‘/config/usb_gadget/g_kbd2/functions/hid.usb0’: No such device

It seems like HID function cannot be created anymore.
So my question is
"Is the number of gadget limited?" and
"If user can adjust limit, how could it be?"


According to further research,
I found out that mass_storage function can be created up to 5,
midi function can be created more than 10.
So the specific limit exists for each USB classes.
However, my project requires beyond HID class' limitation.
Does anyone know the way to manipulate those limits?


Thanks for @mosvy!

Problem solved by this way.

  1. Change a value of HIDG_MINORS in /usr/src/linux-$(uname -r)/drivers/usb/gadget/function/f_hid.c.
  2. Recompile kernel module /usr/src/linux-$(uname -r)/drivers/usb/gadget.
    Kernel Modules which need to be updated are as follows.
    • udc_core
    • libcomposite
    • usb_f_hid

Now you can create HID gadget up to HIDG_MINORS


Viewing all articles
Browse latest Browse all 1186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>