Re: Is g_multi with g_hid possible?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



W dniu 13.01.2015 o 16:10, Felipe Balbi pisze:
Hi,

On Tue, Jan 13, 2015 at 07:05:37AM -0800, Chris McClimans wrote:
Is it possible to appear as a USB gadget hid (kb + mouse),
mass_storage, and ethernet at the same time?

yes, that's called a composite device.

My goal is to try and create a device that when attached during boot
to a PC would be able to send keys as a hid keyboard to select booting
from a USB mass storage.

Booting from the mass storage would then load ipxe and perform dhcp
over the USB RDNIS device. The nic would probably be bridged to wifi,
or at least connected to some type of boot control process.

It has been necessary to unload g_multi in order to load g_hid on the
Edison on 3.10.17 so far and wanted to make sure the end goal was
possible at all.

Have a look at libusbg, you need to cook up your own gadget. g_multi
won't help you here.


To elaborate a bit more on Felipe's answer:

g_multi is an example of a "legacy" gadget; legacy gadgets'
composition of functions (like hid, mass storage, ethernet)
is more or less hardcoded into them and you cannot do
anything about that.

If you want a composition which is not covered by
any of the legacy gadgets, you need to create your own.
Your options for doing that are:

1) Create another "legacy"-style gadget; it is not
that difficult if you have some experience with
gadgets from the kernel side. You don't get
community support in this case and chances of
merging another "legacy"-style gadget into
upstream kernel are rather low unless you have
very good arguments but I can't think of any to
be honest.

2) Compose your gadget using configfs. This feature
has been in the kernel since late 2012 and as of now
all the functions available as
drivers/usb/gadget/function/f_xyz.c are available
for composition with configfs (with uvc being merged
in 3.20). While composing your gadget manually
(using shell) is a perfectly legal thing to do,
the bare configfs interface is intended primarily
for dedicated userspace tools and the tool you
want to look at is libusbg:

https://github.com/libusbg/libusbg

Please note that often the bleeding edge of development
can be found at:

https://github.com/kopasiak/libusbg

AP
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux