Bluetooth wireless activity triggers udev rule
Hi, I'm currently integrating runit and udev. I have a udev rule which runs my Blue-Z startup scripts when I plug in the USB BT dongle:
ACTION="add", ENV{SUBSYSTEM}="bluetooth", RUN+="/usr/bin/sv up bluetooth"
This works really well, cold plugging, etc. No problems.
I've found an interesting quirk though. Here is the sequence of events:
Computer A: I start up my system with the BT dongle inserted, the Blue-Z scripts are started via udev coldplugging script
Computer B: I set up a task which searches for BT devices and tries to form a PPP connection
Computer B: Detects the BT dongle on Computer A, records the address and forms a PPP connection
Computer A: I disable the Blue-Z scripts # sv down bluetooth Computer B: Attempts to connect to A again, and sends a BT signal to connect ...
Computer A: The BT dongle sends a wireless wakeup (wake-on-lan?) signal which causes udev to run the Blue-Z utils startup script again ...
I looked at the udev events to see what was happening when Computer B tried to connect to Computer A. It appears that the two series of events are nearly identical. Can someone suggest a way for me to start the Blue-Z utils *only* when the USB dongle is *inserted* (or first detected).
events caused by plugging in USB Bluetooth dongle:
UDEV [883613218.457062] add /devices/platform/at91_ohci/usb1/1-1/1-1.2/1-1.2:1.0/hci0 (bluetooth) UDEV_LOG=3
ACTIONd DEVPATH=/devices/platform/at91_ohci/usb1/1-1/1-1.2/1-1.2:1.0/hci0 SUBSYSTEM=bluetooth
SEQNUM17
UDEVD_EVENT=1
UDEV [883613231.342314] add /devices/platform/at91_ohci/usb1/1-1/1-1.2/1-1.2:1.0/hci0/acl000F3D5F7205 (bluetooth)
UDEV_LOG=3
ACTIONd DEVPATH=/devices/platform/at91_ohci/usb1/1-1/1-1.2/1-1.2:1.0/hci0/acl000F3D5F7205 SUBSYSTEM=bluetooth
SEQNUM25
UDEVD_EVENT=1
Events caused by trying to connect to the USB Bluetooth dongle from another Bluetooth device:
UDEV [883613131.133343] add /devices/platform/at91_ohci/usb1/1-1/1-1.2/1-1.2:1.0/hci0/acl000F3D5F7205 (bluetooth)
UDEV_LOG=3
ACTIONd DEVPATH=/devices/platform/at91_ohci/usb1/1-1/1-1.2/1-1.2:1.0/hci0/acl000F3D5F7205 SUBSYSTEM=bluetooth
SEQNUM)5
UDEVD_EVENT=1
Aras Vaichas
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Quoted 2 lines · Aras Vaichas
Events caused by trying to connect to the USB Bluetooth dongle from another Bluetooth device:
I also noticed that I receive a PM log message just before the uevents are generated.
PM: Removing info for bluetooth:acl000F3D5F7205
PM: Adding info for bluetooth:acl000F3D5F7205
PM: Adding info for No Bus:rfcomm0
PM: Adding info for No Bus:ppp0
How can I filter out the uevents triggered by the PM system?
Aras
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Quoted 21 lines · Aras Vaichas
Hi, I'm currently integrating runit and udev. I have a udev rule which runs my Blue-Z startup scripts when I plug in the USB BT dongle:
ACTION="add", ENV{SUBSYSTEM}="bluetooth", RUN+="/usr/bin/sv up bluetooth"
This works really well, cold plugging, etc. No problems.
I've found an interesting quirk though. Here is the sequence of events:
Computer A: I start up my system with the BT dongle inserted, the Blue-Z scripts are started via udev coldplugging script
Computer B: I set up a task which searches for BT devices and tries to form a PPP connection
Computer B: Detects the BT dongle on Computer A, records the address and forms a PPP connection
Computer A: I disable the Blue-Z scripts # sv down bluetooth Computer B: Attempts to connect to A again, and sends a BT signal to connect ...
Computer A: The BT dongle sends a wireless wakeup (wake-on-lan?) signal which causes udev to run the Blue-Z utils startup script again ...
Quoted 4 lines
I looked at the udev events to see what was happening when Computer B tried to connect to Computer A. It appears that the two series of events are nearly identical. Can someone suggest a way for me to start the Blue-Z utils *only* when the USB dongle is *inserted* (or first detected).
Match only on the the hci* creation events? ACTION="add", KERNEL="hci[0-9]*", SUBSYSTEM="bluetooth", RUN+="/usr/bin/sv up bluetooth"
Kay
Quoted 29 lines · Kay Sievers
Quoted 21 lines · Aras Vaichas
Hi, I'm currently integrating runit and udev. I have a udev rule which runs my Blue-Z startup scripts when I plug in the USB BT dongle:
ACTION="add", ENV{SUBSYSTEM}="bluetooth", RUN+="/usr/bin/sv up bluetooth"
This works really well, cold plugging, etc. No problems.
I've found an interesting quirk though. Here is the sequence of events:
Computer A: I start up my system with the BT dongle inserted, the Blue-Z scripts are started via udev coldplugging script
Computer B: I set up a task which searches for BT devices and tries to form a PPP connection
Computer B: Detects the BT dongle on Computer A, records the address and forms a PPP connection
Computer A: I disable the Blue-Z scripts # sv down bluetooth Computer B: Attempts to connect to A again, and sends a BT signal to connect ...
Computer A: The BT dongle sends a wireless wakeup (wake-on-lan?) signal which causes udev to run the Blue-Z utils startup script again ...Quoted 5 lines
I looked at the udev events to see what was happening when Computer B tried to connect to Computer A. It appears that the two series of events are nearly identical. Can someone suggest a way for me to start the Blue-Z utils *only* when the USB dongle is *inserted* (or first detected).
Quoted 3 lines
Match only on the the hci* creation events? ACTION="add", KERNEL="hci[0-9]*", SUBSYSTEM="bluetooth", RUN+="/usr/bin/sv up bluetooth"
Yes, that works. USB Bluetooth device insertion will trigger the bluetooth scripts, but bluetooth network activity will not trigger the script. This is good.
Thank you.
Aras
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Quoted 6 lines · Aras Vaichas
Hi, I'm currently integrating runit and udev. I have a udev rule which runs my Blue-Z startup scripts when I plug in the USB BT dongle:
ACTION="add", ENV{SUBSYSTEM}="bluetooth", RUN+="/usr/bin/sv up bluetooth"
Which is the bluetooth connectivity that this USB device is plugging to.
Quoted 4 lines
This works really well, cold plugging, etc. No problems.
I've found an interesting quirk though. Here is the sequence of events:
Here again ?? Bluetooth ??
Quoted 7 lines
Computer A: I start up my system with the BT dongle inserted, the Blue-Z scripts are started via udev coldplugging script
Computer B: I set up a task which searches for BT devices and tries to form a PPP connection
Computer B: Detects the BT dongle on Computer A, records the address and forms a PPP connection
PPP With Bluetooth ???
Quoted 5 lines
Computer A: I disable the Blue-Z scripts # sv down bluetooth Computer B: Attempts to connect to A again, and sends a BT signal to connect ...
Computer A: The BT dongle sends a wireless wakeup (wake-on-lan?) signal which causes udev to run the Blue-Z utils startup script again ...
Bluetooth ?? PPP ???
Quoted 30 lines · Sujit Karataparambil
Quoted 6 lines · Aras Vaichas
Hi, I'm currently integrating runit and udev. I have a udev rule which runs my Blue-Z startup scripts when I plug in the USB BT dongle:
ACTION="add", ENV{SUBSYSTEM}="bluetooth", RUN+="/usr/bin/sv up bluetooth"
Which is the bluetooth connectivity that this USB device is plugging to.
Quoted 4 lines
This works really well, cold plugging, etc. No problems.
I've found an interesting quirk though. Here is the sequence of events:
Here again ?? Bluetooth ??
Quoted 7 lines
Computer A: I start up my system with the BT dongle inserted, the Blue-Z scripts are started via udev coldplugging script
Computer B: I set up a task which searches for BT devices and tries to form a PPP connection
Computer B: Detects the BT dongle on Computer A, records the address and forms a PPP connectionPPP With Bluetooth ???
Quoted 8 lines
Quoted 6 lines
Computer A: I disable the Blue-Z scripts # sv down bluetooth Computer B: Attempts to connect to A again, and sends a BT signal to connect ...
Computer A: The BT dongle sends a wireless wakeup (wake-on-lan?) signal which causes udev to run the Blue-Z utils startup script again ...Bluetooth ?? PPP ???
Sorry, but I do not understand what you are asking here. Can you please write in proper sentences?
Aras
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
I am Very Sorry with my english.
But the whole issue is what are trying to do while
1. connecting an bluetooth device with udev(USB).
2. using PPP with bluetooth.
3. Trying to form network topologies using PPP.
Still very sorry with my english.
Sorry,
Sujit
Quoted 49 lines · Aras Vaichas
Quoted 30 lines · Sujit Karataparambil
Quoted 6 lines · Aras Vaichas
Hi, I'm currently integrating runit and udev. I have a udev rule which runs my Blue-Z startup scripts when I plug in the USB BT dongle:
ACTION="add", ENV{SUBSYSTEM}="bluetooth", RUN+="/usr/bin/sv up bluetooth"
Which is the bluetooth connectivity that this USB device is plugging to.
Quoted 4 lines
This works really well, cold plugging, etc. No problems.
I've found an interesting quirk though. Here is the sequence of events:
Here again ?? Bluetooth ??
Quoted 7 lines
Computer A: I start up my system with the BT dongle inserted, the Blue-Z scripts are started via udev coldplugging script
Computer B: I set up a task which searches for BT devices and tries to form a PPP connection
Computer B: Detects the BT dongle on Computer A, records the address and forms a PPP connectionPPP With Bluetooth ???
Quoted 8 lines
Quoted 6 lines
Computer A: I disable the Blue-Z scripts # sv down bluetooth Computer B: Attempts to connect to A again, and sends a BT signal to connect ...
Computer A: The BT dongle sends a wireless wakeup (wake-on-lan?) signal which causes udev to run the Blue-Z utils startup script again ...Bluetooth ?? PPP ???
Sorry, but I do not understand what you are asking here. Can you please write in proper sentences?
Aras
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Quoted 9 lines · Sujit Karataparambil
I am Very Sorry with my english.
But the whole issue is what are trying to do while
1. connecting an bluetooth device with udev(USB).
2. using PPP with bluetooth.
3. Trying to form network topologies using PPP.Still very sorry with my english.
My question was answered by Kay in the second posting for this thread.
To summarise:
This will trigger on USB bluetooth device insertion *and* network activity/wakeup:
ACTION="add", ENV{SUBSYSTEM}="bluetooth", RUN+="/usr/bin/sv up bluetooth"
This will trigger *only* on USB Bluetooth device insertion (which is what I needed):
ACTION="add", KERNEL="hci[0-9]*", SUBSYSTEM="bluetooth",RUN+="/usr/bin/sv up bluetooth"
That's all there is to it.
Aras
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
Seems correct but, I have a doubt about this change from moving since 2.6.15 on.
https://lists.ubuntu.com/archives/ubuntu-devel-announce/2005-December/000028.html
Do not know whether the posting has been moved to mainstream.
Also there seems to be some misnomer regarding hot plug from this posting as seen in this, from the discussion we are having here.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug'4297
This seems to very current on Linux mainstream (2.6.8)
Sorry for my pessimism and English.
Just out of curiosity.
Thanks for your time on this,
Sujit
Quoted 39 lines · Aras Vaichas
Quoted 9 lines · Sujit Karataparambil
I am Very Sorry with my english.
But the whole issue is what are trying to do while
1. connecting an bluetooth device with udev(USB).
2. using PPP with bluetooth.
3. Trying to form network topologies using PPP.Still very sorry with my english.
My question was answered by Kay in the second posting for this thread.
To summarise:
This will trigger on USB bluetooth device insertion *and* network activity/wakeup:
ACTION="add", ENV{SUBSYSTEM}="bluetooth", RUN+="/usr/bin/sv up bluetooth"
This will trigger *only* on USB Bluetooth device insertion (which is what I needed):
ACTION="add", KERNEL="hci[0-9]*", SUBSYSTEM="bluetooth",RUN+="/usr/bin/sv up bluetooth"That's all there is to it.
Aras
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________