You are not logged in.

#1 2009-07-28 23:13:23

Allamgir
Member
Registered: 2009-06-11
Posts: 168

[SOLVED] Don't have permission to turn off bluetooth, even with sudo!

I never use bluetooth on my laptop, but every time I boot arch the radio and light are both on. I tried unloading the bluetooth module, using bluez and other tools to shut off bluetooth, etc., but that radio just stays on. After searching the web for a while, I finally found the solution: cut off power to the device. I can do that with this command:

echo "0" > /sys/devices/platform/sony-laptop/bluetoothpower

And turn it back on by changing "0" to "255". The only problem is, I can't run this as a normal user, and I can't even run it with sudo! Here is the output:

$  echo "0" > /sys/devices/platform/sony-laptop/bluetoothpower
zsh: permission denied: /sys/devices/platform/sony-laptop/bluetoothpower
$  sudo echo "0" > /sys/devices/platform/sony-laptop/bluetoothpower
zsh: permission denied: /sys/devices/platform/sony-laptop/bluetoothpower

(I'm using zsh but this also happens with bash)

However, I can su to root and run this command successfully

$  su
Password: 
#  echo "0" > /sys/devices/platform/sony-laptop/bluetoothpower

And off goes the light. I would like to somehow turn off bluetooth at boot, but I don't know how to have Arch run a command as the root user at boot after loading the modules (to ensure the bluetooth radio is not started up again). It seems that bluetoothpower is created at each boot, because I tried changing the permissions to read & write for all, then adding the command to my .xinitrc. This worked, but only during that session. After rebooting I had the same problem.

Help?

Last edited by Allamgir (2009-07-29 13:44:40)


дɭɭɑӎɠїɾ

Offline

#2 2009-07-28 23:16:12

stray
Member
Registered: 2009-06-21
Posts: 12

Re: [SOLVED] Don't have permission to turn off bluetooth, even with sudo!

Put it in /etc/rc.local smile

Last edited by stray (2009-07-28 23:17:15)

Offline

#3 2009-07-28 23:38:22

majiq
Member
Registered: 2009-03-06
Posts: 259

Re: [SOLVED] Don't have permission to turn off bluetooth, even with sudo!

You have to do funny things to get sudo to work with redirection. What they are precisely, I cannot recall. However a sudo -s would achieve the same thing. Also, a script. But as stray said, putting it in rc.local is probably your best bet.

Offline

#4 2009-07-28 23:57:14

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Re: [SOLVED] Don't have permission to turn off bluetooth, even with sudo!

Hooray! it works! I can now save power by not using bluetooth!

Unfortunately, the bluetooth radio still comes on after suspending and resuming. How can I have this command run as root immediately after resuming from suspend to RAM? I use pm-utils.


дɭɭɑӎɠїɾ

Offline

#5 2009-07-29 03:07:54

majiq
Member
Registered: 2009-03-06
Posts: 259

Re: [SOLVED] Don't have permission to turn off bluetooth, even with sudo!

Check the pm-utils wiki page. It's pretty comprehensive.

Offline

#6 2009-07-29 11:00:20

broch
Banned
From: L.A. California
Registered: 2006-11-13
Posts: 975

Re: [SOLVED] Don't have permission to turn off bluetooth, even with sudo!

with sudo try:
sudo 'echo "0" > /sys/devices/platform/sony-laptop/bluetoothpower'

Offline

#7 2009-07-29 13:44:23

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Re: [SOLVED] Don't have permission to turn off bluetooth, even with sudo!

Yes! Yet again the wiki has saved me! I followed this part: http://wiki.archlinux.org/index.php/Pm- … _own_hooks

I just set it to turn off bluetooth upon resume, and it works! yay!

Thanks everyone!


дɭɭɑӎɠїɾ

Offline

Board footer

Powered by FluxBB