Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10th June 2010, 11:16 PM
dd_wizard's Avatar
dd_wizard Offline
Registered User
 
Join Date: Sep 2009
Posts: 1,409
linuxfedorafirefox
How to enable autosuspend for laptop webcams.

First, ignore powertop's recommendation. After searching around the web, that message about how to enable autosuspend is very out of date. This thread discusses the history of the powertop suggestion, and discusses using the driver or udev to autosuspend an eeepc webcam. It also includes this nugget:
Quote:
In the mean time - the thread I linked to includes a helpful note from
Xandros. They measured that enabling the camera on the 901 model cost
~3% of overall power.
So autosuspending the camera won't extend your battery life that much, but every little bit helps. This page describes the user interface for dynamic power management in a device's sysfs directory. This caveat and another note from that page should be considered:
Quote:
214 For this reason, by default the kernel disables autosuspend (the
215 power/level attribute is initialized to "on") for all devices other
216 than hubs. Hubs, at least, appear to be reasonably well-behaved in
217 this regard.

232 If a driver knows that its device has proper suspend/resume support,
233 it can enable autosuspend all by itself. For example, the video
234 driver for a laptop's webcam might do this, since these devices are
235 rarely used and so should normally be autosuspended.
Apparently, webcam drivers rarely enable autosuspend. A udev rule can enable autosuspend when the driver doesn't. From what I've read and the results on my three year old Toshiba laptop, this should work on most recent laptops and kernels.

First, run this command:
Quote:
[gene@Mobile-PC ~]$ sudo powertop -d -t0
PowerTOP 1.11 (C) 2007, 2008 Intel Corporation
...
Recent USB suspend statistics
Active Device name
100.0% USB device 4-1 : USB RECEIVER (Logitech)
100.0% USB device 1-6 : Chicony USB 2.0 Camera (Chicony Electronics Co., Ltd.)
0.0% USB device usb5 : UHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 uhci_hcd)
100.0% USB device usb4 : UHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 uhci_hcd)
0.0% USB device usb3 : UHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 uhci_hcd)
0.0% USB device usb2 : UHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 uhci_hcd)
100.0% USB device usb1 : EHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 ehci_hcd)
Notice that the Chicony USB 2.0 Camera is active 100% of the time, even though the LED is off, and no software is accessing it. The other useful information is the device for the built in camera, USB device 1-6. As described in the above linked kernel PM Docs, change to the /sys/bus/usb/devices/1-6 directory and do some poking around.

NOTE: Since the /sys directory tree is world readable, but only writeable by root, it's a good idea to be a normal user while poking around in it. Also, substitute the USB device number powertop returned for your camera where ever you see 1-6 in the following:
Quote:
[gene@Mobile-PC ~]$ cd /sys/bus/usb/devices/1-6

[gene@Mobile-PC 1-6]$ cat manufacturer product idVendor idProduct
Chicony Electronics Co., Ltd.
Chicony USB 2.0 Camera
04f2
b008

[gene@Mobile-PC 1-6]$ cat power/level power/autosuspend
on
2
The contents of the manufacturer and product files should match the output of the powertop command shown earlier. If they don't, you need to do some research. The contents of the idVendor and idProduct files will be used to write the udev rule. The power/level value of "on" forces the device to the on state, or never autosuspend. The power/autosuspend value is the delay in seconds before autosuspending, when it's enabled. If something is amiss, use the following command and examine the first portion of the output:
Quote:
$ [gene@Mobile-PC 1-6]$ udevadm info --path=/sys/bus/usb/devices/1-6 --attribute-walk

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device '/devices/pci0000:00/0000:00:1d.7/usb1/1-6':
...
SUBSYSTEM=="usb"
...
ATTR{idVendor}=="04f2"
ATTR{idProduct}=="b008"
...
ATTR{manufacturer}=="Chicony Electronics Co., Ltd."
ATTR{product}=="Chicony USB 2.0 Camera"
...
The above quote includes only the portions of the output needed for writing this autosuspend rule and for verifying against the previous powertop output. Don't let the path shown in the udevadm output throw you. The /sys tree is so full of sym links it's easy to get lost. Udevadm is showing the real directory that the user interface directory is linked to. Older guides for writing udev rules suggest using a file named 10-local.rules, but udev used to use the first rule it encountered. Now, udev uses the last rule it encounters, so newer guides recommend using a file named 99-local.rules.

As root, create and edit the file /etc/udev/rules.d/99-local.rules and add the line shown below.

NOTE: In the following, == is a test for equality, = is an assignment operator. Don't confuse them.
NOTE: Be sure to replace 04f2 and, b008 with the corresponding attributes for your camera.
Quote:
SUBSYSTEM=="usb", ATTR{idVendor}=="04f2", ATTR{idProduct}=="b008", ATTR{power/level}="auto"
The rule just sets the contents of the device directory's "power/level" file to "auto" when the device specified by ATTRibutes is detected. The command "udevadm control --reload-rules" doesn't affect existing devices, so you won't see any change until you reboot. After rebooting, check /var/log/boot.log for any udev errors related to the new rule. After the boot, you should see this:
Quote:
[gene@Mobile-PC ~]$ sudo powertop -d -t0
PowerTOP 1.11 (C) 2007, 2008 Intel Corporation
...
Recent USB suspend statistics
Active Device name
100.0% USB device 4-1 : USB RECEIVER (Logitech)
0.0% USB device 1-6 : Chicony USB 2.0 Camera (Chicony Electronics Co., Ltd.)
0.0% USB device usb5 : UHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 uhci_hcd)
100.0% USB device usb4 : UHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 uhci_hcd)
0.0% USB device usb3 : UHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 uhci_hcd)
0.0% USB device usb2 : UHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 uhci_hcd)
0.0% USB device usb1 : EHCI Host Controller (Linux 2.6.34-20.fc14.x86_64 ehci_hcd)
Lastly, start a webcam application and make sure everything works. Disaster recovery is simple. Delete the local rule file or the new rule from it, whichever is appropriate, and reboot.

dd_wizard

Last edited by dd_wizard; 17th June 2010 at 07:10 PM. Reason: Remove the bcdDevice attribute.
Reply With Quote
  #2  
Old 10th June 2010, 11:34 PM
GoinEasy9's Avatar
GoinEasy9 Offline
Registered User
 
Join Date: May 2009
Location: Manorville, New York, USA
Posts: 1,583
linuxfedorafirefox
Re: How to enable autosuspend for laptop webcams.

I bow to the Master, geez, what great info. Now, to get to try it out.
__________________
Registered Linux User #348347
Have you been seduced by siduction? http://siduction.org/index.php
Running Fedora 17/18, siduction and openSUSE Tumbleweed with KDE
Reply With Quote
Reply

Tags
autosuspend, enable, laptop, webcams

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HP Nc6000 laptop wireless enable? sozham Hardware & Laptops 2 8th June 2012 01:57 PM
why can't my laptop enable desktop effects. yzpdsg Hardware & Laptops 3 24th January 2009 12:17 AM
Set autosuspend via udev rule or hal policy? logularjason Hardware & Laptops 0 14th January 2008 07:55 AM
Enable, Dissable Mouse Pad on Laptop telepatico Hardware & Laptops 7 15th June 2007 12:36 AM
Enable extra button HP laptop Crimson Tide Hardware & Laptops 0 29th December 2005 04:55 PM


Current GMT-time: 21:51 (Wednesday, 19-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat