You are not logged in.
From here, it is suggested that a UDev rule be used to setup USB autosuspend for devices that support it, rather than the little Bash script that's currently featured on the page.
Well, I cannot, for the life of me, seem to be able to write the UDev rule for this one. I've managed to write the UDev rules for all the other suggested power saving tweaks, but the USB autosuspend one evades me.
Here is the udevadm info output for one of my devices:
# udevadm info -a -p /sys/bus/usb/devices/1-2
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:1a.7/usb1/1-2':
KERNEL=="1-2"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{bDeviceSubClass}=="02"
ATTR{bDeviceProtocol}=="01"
ATTR{devpath}=="2"
ATTR{idVendor}=="05ac"
ATTR{speed}=="480"
ATTR{bNumInterfaces}==" 3"
ATTR{bConfigurationValue}=="1"
ATTR{bMaxPacketSize0}=="64"
ATTR{busnum}=="1"
ATTR{devnum}=="3"
ATTR{configuration}==""
ATTR{bMaxPower}=="500mA"
ATTR{authorized}=="1"
ATTR{bmAttributes}=="80"
ATTR{bNumConfigurations}=="1"
ATTR{maxchild}=="0"
ATTR{bcdDevice}=="0646"
ATTR{avoid_reset_quirk}=="0"
ATTR{quirks}=="0x0"
ATTR{serial}=="CCGB6H0EHKDL8LFX"
ATTR{version}==" 2.00"
ATTR{urbnum}=="16"
ATTR{ltm_capable}=="no"
ATTR{manufacturer}=="Apple Inc."
ATTR{removable}=="fixed"
ATTR{idProduct}=="850a"
ATTR{bDeviceClass}=="ef"
ATTR{product}=="FaceTime Camera (Built-in)"
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}==" 0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="6"
ATTRS{bcdDevice}=="0306"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="0000:00:1a.7"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="41"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 3.6.6-1-ARCH ehci_hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0002"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="EHCI Host Controller"
looking at parent device '/devices/pci0000:00/0000:00:1a.7':
KERNELS=="0000:00:1a.7"
SUBSYSTEMS=="pci"
DRIVERS=="ehci_hcd"
ATTRS{irq}=="23"
ATTRS{subsystem_vendor}=="0x8086"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0320"
ATTRS{companion}==""
ATTRS{consistent_dma_mask_bits}=="32"
ATTRS{dma_mask_bits}=="32"
ATTRS{local_cpus}=="00000000,0000000f"
ATTRS{device}=="0x1c2d"
ATTRS{uframe_periodic_max}=="100"
ATTRS{enable}=="1"
ATTRS{msi_bus}==""
ATTRS{local_cpulist}=="0-3"
ATTRS{vendor}=="0x8086"
ATTRS{subsystem_device}=="0x7270"
ATTRS{numa_node}=="-1"
ATTRS{d3cold_allowed}=="1"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
There doesn't seem to be much useful in there, so I go a bit further:
# udevadm info -a -p /sys/bus/usb/devices/1-2/power
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 '/bus/usb/devices/1-2/power':
KERNEL=="power"
SUBSYSTEM=="subsystem"
DRIVER==""
ATTR{control}=="auto"
ATTR{active_duration}=="2750"
ATTR{async}=="enabled"
ATTR{level}=="auto"
ATTR{autosuspend}=="2"
ATTR{connected_duration}=="824030"
ATTR{runtime_enabled}=="enabled"
ATTR{runtime_active_kids}=="0"
ATTR{runtime_active_time}=="2533"
ATTR{autosuspend_delay_ms}=="2000"
ATTR{runtime_status}=="suspended"
ATTR{runtime_usage}=="0"
ATTR{persist}=="1"
ATTR{runtime_suspended_time}=="821266"
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-2':
KERNELS=="1-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="02"
ATTRS{bDeviceProtocol}=="01"
ATTRS{devpath}=="2"
ATTRS{idVendor}=="05ac"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 3"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{busnum}=="1"
ATTRS{devnum}=="3"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="500mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="80"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="0"
ATTRS{bcdDevice}=="0646"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="CCGB6H0EHKDL8LFX"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="16"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Apple Inc."
ATTRS{removable}=="fixed"
ATTRS{idProduct}=="850a"
ATTRS{bDeviceClass}=="ef"
ATTRS{product}=="FaceTime Camera (Built-in)"
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}==" 0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="6"
ATTRS{bcdDevice}=="0306"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="0000:00:1a.7"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="41"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 3.6.6-1-ARCH ehci_hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0002"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="EHCI Host Controller"
looking at parent device '/devices/pci0000:00/0000:00:1a.7':
KERNELS=="0000:00:1a.7"
SUBSYSTEMS=="pci"
DRIVERS=="ehci_hcd"
ATTRS{irq}=="23"
ATTRS{subsystem_vendor}=="0x8086"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0320"
ATTRS{companion}==""
ATTRS{consistent_dma_mask_bits}=="32"
ATTRS{dma_mask_bits}=="32"
ATTRS{local_cpus}=="00000000,0000000f"
ATTRS{device}=="0x1c2d"
ATTRS{uframe_periodic_max}=="100"
ATTRS{enable}=="1"
ATTRS{msi_bus}==""
ATTRS{local_cpulist}=="0-3"
ATTRS{vendor}=="0x8086"
ATTRS{subsystem_device}=="0x7270"
ATTRS{numa_node}=="-1"
ATTRS{d3cold_allowed}=="1"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
And, voila! The control and autosuspend attributes are there, but these rules don't seem to work:
ACTION=="add", KERNEL=="power", SUBSYSTEM=="subsystem", ATTR{control}="auto"
ACTION=="add", KERNEL=="power", SUBSYSTEM=="subsystem", ATTR{autosuspend}="2"
Adding the SUBSYSTEMS and DRIVER parameters of the parent device did not work, either. Should I add the KERNELS parameter of the parent device, too?
I'm sure I'm messing up something that is incredibly obvious to the well initiated. Can't seem to figure out what I'm screwing up.
Setting up scsi link power management was a breeze... This, not so much....
Appreciate any help anyone's willing to lend.
Last edited by ego.abyssi (2012-11-28 00:52:05)
Fortune sides with him who dares -Virgil
Offline
By the way, how do you manage to enable HDD powersaving link state?
This is how I solved it:
SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"
Last edited by eruditorum (2012-11-23 11:54:37)
Offline
I am using with success
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="1"
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"
@eruditorum
1. echo is not in /usr/lib/udev, so you should specify the whole path /usr/bin/echo
2. I don't think you can use shell redirection: use
RUN+="/bin/sh -c 'echo ...'"
Offline
aesiris, thank you. I don't recall seeing TEST in the UDev Rules Tutorial. Very handy. I noticed that you don't have a comma after the TEST clause. Is that deliberate, or was that just a typo?
eruditorum, that's pretty much exactly how I got scsi link power management to work. I merely specified KERNEL before SUBSYSTEM and also specified SUBSYSTEMS=="scsi". Seems like the SUBSYSTEMS specification was unneeded.
Fortune sides with him who dares -Virgil
Offline
Just a quick thanks that it worked, aesiris.
Also on the that page: https://wiki.archlinux.org/index.php/Po … Management
i2c device power management can be managed with very much the same rule structure:
ACTION=="add", SUBSYSTEM=="i2c", TEST=="power/control", ATTR{power/control}="auto"
Can't for sure say the same for spi devices, since I apparently have none. I'd edit that page, but I can't.
Fortune sides with him who dares -Virgil
Offline