There are some questions on U&L that ask about how to correctly remove an USB device from Linux box, implicitly meaning a block device, having been in used via a mounted filesystem on top of it.
Well, there are other USB devices also, and I wanted to ask about the more general case. Let's say I wanted to remove an USB webcam gadget from my Linux box. Is the correct/safe way to simply write to issue a finale:
$ echo "1" | sudo tee /sys/bus/usb/devices/<device-addr>/remove
NOTE: I have noticed that with usb-mass-storage devices, I can "remove" the power via the command above, even though they have not been unmounted. The mount point remains and access to it results in
which seems to indicate that also for other type of USB devices (e.g. the webcam gadget) I might need to first remove loaded kernel (i.e. via
rmmod) or otherwise deactivate the device to be removed?