On Thu, 2 Apr 2020, Greg KH wrote: > On Thu, Apr 02, 2020 at 09:19:06AM +0200, massimo wrote: > > I've read the interesting Greg's article about writing USB driver for > > Linux. > > I'm interested in a simpler question. Is it possible > > to write a driver in Ubuntu (19.10) to switch power on or off to a USB > > port, that' s to say to give or take off the 5 volts power supply to a > > USB port (in order for example to switch on or off a simple usb lamp)? > > Thanks for your attention and courtesy, Massimo. > > > > Try the userspace program 'usbreset' that is part of the usbutils > package, and can be found also here: > https://github.com/gregkh/usbutils/blob/master/usbreset.c Or you can use the program that was posted here: https://marc.info/?l=linux-usb&m=127162615232234&w=2 This program turns power on and off for specific ports, as opposed to resetting the entire hub. Alan Stern > if your hub supports it, this will work. Note, not all USB hubs support > this type of behavior, as it is not required by the USB specification. > > hope this helps,