atom feed6 messages in org.freebsd.freebsd-usbUtility to Suspend/Disable/Enable Pow...
FromSent OnAttachments
Anish MistryMar 5, 2008 9:06 am 
Hans Petter SelaskyMar 6, 2008 4:54 pm 
Anish MistryMar 6, 2008 5:18 pm 
Hans Petter SelaskyMar 6, 2008 6:10 pm 
jerryJan 5, 2010 6:18 pm 
Hans Petter SelaskyJan 6, 2010 12:27 am 
Subject:Utility to Suspend/Disable/Enable Power Off USB ports
From:Hans Petter Selasky (hsel@c2i.net)
Date:Mar 6, 2008 6:10:19 pm
List:org.freebsd.freebsd-usb

Hi Anish,

I think that when you re-enable the port the kernel should do a re-enumeration.

Also when you suspend/resume a device, the "suspend" and "resume" methods of the device should get called. I will have a look at it.

--HPS

On Thursday 06 March 2008, Anish Mistry wrote:

On Thursday 06 March 2008, Hans Petter Selasky wrote:

Hi,

I think that we should have this functionality in the USB kernel like a separate IOCTL, that only takes an USB address like argument, hence every USB device in the kernel knows which is its parent HUB.

Yes, this would be ideal.

There is a problem when you do a port reset, and that is that the USB device goes into the unaddressed state, and starts responding to address 0. If another device is being enumerated at the same time, this might cause problems.

Hmmm...Any suggestions?

BTW: What are the main purposes of your program?

To shutoff a USB device so that it knows to stop. See my email earlier to the list entitled "Suspend/Sleep/Stop USB device". Basically my built-in camera was getting hot and drawing power. I needed a way to shut it down as not to waste power.

--HPS

On Wednesday 05 March 2008, Anish Mistry wrote:

I've written the upower utility allows you to selectively suspend usb ports. It acts similar to the Windows "Stop Removable Device" process. It has only been tested on 7.0-RELEASE.

WARNING: This program may eat your lunch and kick your dog. You've been warned.

Download and compile.

fetch http://am-productions.biz/docs/upower.c gcc -o upower upower.c

You will need to be root or have rw access to the uhub devices. eg. /dev/usbX

Use "usbdevs -v" to find the port/device to suspend. # usbdevs -v Controller /dev/usb0: addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00 port 1 powered port 2 powered Controller /dev/usb1: addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00 port 1 powered port 2 addr 2: low speed, power 100 mA, config 1, product 0x0009 (0x0009), vendor 0x045e(0x045e), rev 1.05 Controller /dev/usb2: addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00 port 1 powered port 2 addr 2: full speed, power 100 mA, config 1, Fingerprint Sensor(0x2580), vendor 0x08ff(0x08ff), rev 6.23 Controller /dev/usb3: addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00 port 1 powered port 2 powered Controller /dev/usb4: addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), Intel(0x0000), rev 1.00 port 1 powered port 2 powered port 3 addr 2: high speed, self powered, config 1, product 0x005a(0x005a), vendor 0x0409(0x0409), rev 1.00 port 1 powered port 2 powered port 3 powered port 4 powered port 4 powered Controller /dev/usb5: addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), Intel(0x0000), rev 1.00 port 1 powered port 2 powered port 3 powered port 4 addr 2: high speed, power 320 mA, config 1, Sirius USB2.0 Camera(0x3343), Vimicro Corp.(0x0ac8), rev 1.00

Since my built-in USB camera draws power when not in use, I'll suspend it to save battery time.

# ./upower /dev/usb5 4 suspend