All of lore.kernel.org
 help / color / mirror / Atom feed
* Usb_power_supply
@ 2020-04-02  7:19 massimo
  2020-04-02  7:39 ` Usb_power_supply Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: massimo @ 2020-04-02  7:19 UTC (permalink / raw)
  To: linux-usb

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Usb_power_supply
  2020-04-02  7:19 Usb_power_supply massimo
@ 2020-04-02  7:39 ` Greg KH
  2020-04-02 14:12   ` Usb_power_supply Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2020-04-02  7:39 UTC (permalink / raw)
  To: massimo; +Cc: linux-usb

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

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,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Usb_power_supply
  2020-04-02  7:39 ` Usb_power_supply Greg KH
@ 2020-04-02 14:12   ` Alan Stern
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2020-04-02 14:12 UTC (permalink / raw)
  To: Greg KH; +Cc: massimo, linux-usb

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,


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-02 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02  7:19 Usb_power_supply massimo
2020-04-02  7:39 ` Usb_power_supply Greg KH
2020-04-02 14:12   ` Usb_power_supply Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.