Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to disable the built-in card reader in my MBP (5,3) running Debian testing. I've noticed that powertop lists the card reader as a major contributor of wake up events and would like to disable it as I rarely need to read SD cards.

I found this with "dmesg":

scsi 6:0:0:0: Direct-Access APPLE SD Card Reader 1.00 PQ: 0 ANSI: 0

and this from "sg_scan -i":

/dev/sg2: scsi6 channel=0 id=0 lun=0 [em] APPLE SD Card Reader 1.00 [rmb=1 cmdq=0 pqual=0 pdev=0x0]

I don't know where to find the device in /proc and there are no modules loaded for this device (I'm guessing it has support compiled into the kernel).

So, ideally, I would like to be able to enable/disable this device without a kernel recompile. Is this possible?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Most likely the card reader is an USB storage device. However, it does not cause wakeups by itself — instead, HAL or udisks need to poll it in order to detect media changes, and this polling shows up in powertop. It is possible to disable this polling, but then media changes will not be detected (however, the device will still work, usually trying to access /dev/sdX will cause the kernel to detect media change and detect partitions, then mounting those partitions will be possible).

You can look for the polling processes on your system — HAL and udisks show polled device names in the command line visible in the ps output:

ps ax | grep /dev/sdX

With HAL there is a separate hald-addon-storage process for every polled device; with udisks there is a single udisks-daemon process for all polled devices in the system.

Disabling polling for HAL is easy — there is a special command for it:

hal-disable-polling --device /dev/sdX

If you want to reenable polling later, use the same command with the additional --enable-polling option.

For newer udisks the situation is more complicated. First, you need a new enough udisks package: Debian bug #559562 says that udisks >= 1.0.0~git20100223.a38230-2 is needed. Next, you need to add an udev rule for your device as described in http://bugs.freedesktop.org/show_bug.cgi?id=26508#c0. For your device the rule should probably look like:

SUBSYSTEM=="block", ENV{ID_VENDOR}=="APPLE*", ENV{ID_MODEL}=="SD Card Reader*", ENV{UDISKS_DISABLE_POLLING}="1" 

Put this rule in a newly created file in /etc/udev/rules.d/ (e.g., 99-local.rules).

share|improve this answer
    
Thanks, that looks like exactly what I needed. It's not working quite yet, but I think it will with a little bit of fiddling. –  zcid Dec 11 '10 at 20:18
    
Update: It worked! Thank you! –  zcid Dec 11 '10 at 20:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.