LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 03-26-2007, 11:18 PM   #1
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Rep: Reputation: 31
ACPI Script for bluetooth


I wrote a little bluetooth script for acpi. It's run when a fn+f5 hotkey is pressed on the thinkpad:

Code:
#!/bin/bash

if grep "^status.*disabled" /proc/acpi/ibm/bluetooth
then
        echo 'enable' > /proc/acpi/ibm/bluetooth

        modprobe bluetooth
        modprobe l2cap
        modprobe hci_usb
        modprobe rfcomm

        rm /var/run/dbus/dbus.pid
        dbus-daemon --config-file=/etc/dbus-1/system.conf
        sdpd
        hcid

else
        echo 'disable' > /proc/acpi/ibm/bluetooth

        killall dbus-daemon
        killall sdpd
        killall hcid

        modprobe -r rfcomm
        modprobe -r hci_usb
        modprobe -r l2cap
        modprobe -r bluetooth

fi

exit 0

There is one problem with it. When the script is trying to do 'modprobe -r hci_usb', it says that the module is busy, but when I try to run the command manually right after the script was run, it works perfectly.

Any ideas what's going on?

Last edited by alkos333; 03-27-2007 at 12:37 AM.
 
Old 03-27-2007, 12:18 AM   #2
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
That's not the entire script is it ? There is a 'fi' after that right ? and perhaps an 'exit 0' too ?

Does it work to make a script that just runs 'modprobe -r hci_usb' ? Does it give you the same error, or just the sequence there ?

Code:
        modprobe -r rfcomm
        modprobe -r hci_usb
        modprobe -r l2cap
        modprobe -r bluetooth
does the order of these make a difference ?

As for echoing things into '/proc' ... I don't think it's a good idea , but whatever you wanna do.

Last edited by H_TeXMeX_H; 03-27-2007 at 12:21 AM.
 
Old 03-27-2007, 12:37 AM   #3
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Original Poster
Rep: Reputation: 31
Yeah, I created a test.sh with that one line and it works, but it won't work from within this script..

Yeah, I think I solved it. rfcomm and l2cap libs just don't have enough time to be removed first. I tried inserting a sleep statement before hci_usb and it worked.

Last edited by alkos333; 03-27-2007 at 12:41 AM.
 
Old 03-27-2007, 12:42 AM   #4
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Try this:

Code:
while :
do
  if modprobe -r hci_usb
  then
    break 1
  fi
done
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux ACPI and BIOS ACPI - problem to understand and giving out bugs marisdembovskis Linux - Software 3 09-20-2007 11:22 PM
ACPI: 2.6.17.7; nothing in /proc/acpi/fan; fans not running; problem not seen before. zetabill Linux - Kernel 1 07-30-2006 05:27 PM
acpi can't run my script huru Linux - Laptop and Netbook 0 03-19-2006 06:17 AM
acpi and bash script! rohan208 Linux - General 0 07-23-2004 01:45 PM
kernel 2.4.20 & acpi-20021212-2.4.20.diff => no /proc/acpi Tinkster Linux - Software 5 03-24-2003 02:56 PM


All times are GMT -5. The time now is 06:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration