For some time, I'm seeing strange messages in powertop with mounted SD card:
A USB device is active 100.0% of the time: USB device 5-5 : UB6225 (ENE)
Since I'm leaving for OSCON (and will mostly work on eee while there) I wanted to be conservative about my battery usage, so I took a closer look at this problem.
At first, installing autofs seemed like good idea. However, autofs can't run scripts (and I really want to toggle card reader's power) so I took a looked at afuse which seemed nice, but I didn't want to add another layer of indirection (missing timeout feature could be solved by script which sleeps in background).
Than I thought about it a bit more and decided that best solution is probably simplest possible: do a small shell script. I usually know when I want to access files on SD card anyway (otherwise, I couldn't really power off card because I would be using files on it).
#!/bin/shdir=/rest
if mount | grep $dir >/dev/null ; then
umount $dir && sudo sh -c "echo 0 > /proc/acpi/asus/cardr"
sudo rmmod usb-storage
sudo dmesg -c
else
if [ `cat /proc/acpi/asus/cardr` -eq 1 ] ; then
mount $dir && df $dir
else
sudo modprobe usb-storage delay_use=0
sudo sh -c "echo 1 > /proc/acpi/asus/cardr"
sudo dmesg -c
sleep 2
sudo dmesg -c
mount $dir && df $dir
fi
fi
You might want to remove dmesg calls if you don't care about output or don't want this script to mess with your kernel logs.