Fwd: Add/remove USB gadget functions without UDC unbind

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

 



I am working on adding USB mass storage functionality to embedded
device and I need to determine if device is connected to USB host or
power-only source (like powerbank).
When connected to host, device must stop using mass storage partition
(LUN) and unmount it. When disconnected, device must mount it back and
start using. This implies only if connected to USB host. When
connected to powerbank, device must continue using mass storage.

To determine if USB host is connected, I am tracking USB gadget state
via `sysfs` in user space.
USB gadget state is exposed to `sysfs` only if gadget is bind to UDC
and at least one function is enabled. So I am creating gadget with
serial and ethernet functions enabled at device startup.
When host is detected (state `configured`), I would like to enable
mass storage functionality using configfs and disable it when host is
disconnected without the need to unbind and bind UDC again.
This is not possible with kernel 4.11.

The question is why this is not possible and what are the side effects
of implementing this?

Ros



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

  Powered by Linux