You are not logged in.

#1 2016-01-04 11:56:31

Anvbis
Member
Registered: 2015-12-25
Posts: 14

Hotplug bluetooth mouse after turning it off - udev rule

I`m looking for a true bluetooth mouse hotplug on a Dell laptop.
By "true" I mean I won`t have to pair-connect the mouse every time I have turned it off (for example, not to waste mouse battery when I watch a movie).
I`m using bluetoothctl.
I have read the "Bluetooth" wiki article and have the following rule

# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"

at /etc/udev/rules.d/10-local.rules.
What should I add to re-enable the mouse after turning it off?

Last edited by Anvbis (2016-01-06 11:05:49)


One doesn`t simply do simply.

Offline

#2 2016-01-04 14:25:38

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Hotplug bluetooth mouse after turning it off - udev rule

Well, if you perform a power cycle of the mouse with `udevadm monitor` running, do you see anything comes up?

Offline

#3 2016-01-04 15:35:44

Anvbis
Member
Registered: 2015-12-25
Posts: 14

Re: Hotplug bluetooth mouse after turning it off - udev rule

No. Empty.
Even "trigger" doesn`t help - it mounts (again) the inserted cd.

[anvbis@anvbislaptop ~]$ sudo udevadm monitor --environment
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

Last edited by Anvbis (2016-01-04 15:36:48)


One doesn`t simply do simply.

Offline

#4 2016-01-04 15:39:11

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Hotplug bluetooth mouse after turning it off - udev rule

Hmm I don't know how you can implement it with a udev rule then. Unless you can find some daemon or so which triggers an event when there is a power cycle.

Offline

#5 2016-01-04 15:41:17

Anvbis
Member
Registered: 2015-12-25
Posts: 14

Re: Hotplug bluetooth mouse after turning it off - udev rule

Looks like it`s fair - wiki states that the bluetooth device in the default rule will be active only after reboot.
But I`m a bit tired of rebooting.


One doesn`t simply do simply.

Offline

#6 2016-01-04 15:50:25

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Hotplug bluetooth mouse after turning it off - udev rule

You mean you need to reboot to get the mouse working again if you perform a power cycle on the mouse? Didn't you say re-pairing it up again is enough?

Offline

#7 2016-01-04 16:22:45

Anvbis
Member
Registered: 2015-12-25
Posts: 14

Re: Hotplug bluetooth mouse after turning it off - udev rule

Right. I would rather re-enter login/password than re-pair the mouse like

# bluetoothctl 
[NEW] Controller 00:10:20:30:40:50 pi [default]
[bluetooth]# agent KeyboardOnly 
Agent registered
[bluetooth]# default-agent 
Default agent request successful
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:10:20:30:40:50 Discovering: yes
[NEW] Device 00:12:34:56:78:90 myLino
[CHG] Device 00:12:34:56:78:90 LegacyPairing: yes
[bluetooth]# pair 00:12:34:56:78:90
Attempting to pair with 00:12:34:56:78:90
[CHG] Device 00:12:34:56:78:90 Connected: yes
[CHG] Device 00:12:34:56:78:90 Connected: no
[CHG] Device 00:12:34:56:78:90 Connected: yes
Request PIN code
[agent] Enter PIN code: 1234
[CHG] Device 00:12:34:56:78:90 Paired: yes
Pairing successful
[CHG] Device 00:12:34:56:78:90 Connected: no

One doesn`t simply do simply.

Offline

#8 2016-01-04 16:29:28

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Hotplug bluetooth mouse after turning it off - udev rule

But you do NOT need to re-pair it after reboot? If so, what if you run `hciconfig hci0 reset` (as root/with sudo) instead of rebooting/re-pairing?

Last edited by tom.ty89 (2016-01-04 16:29:51)

Offline

#9 2016-01-04 20:50:27

Anvbis
Member
Registered: 2015-12-25
Posts: 14

Re: Hotplug bluetooth mouse after turning it off - udev rule

Well, I added "|change" to ACTION value and it worked.
Thanks for help.

P.S. It didn`t.

Last edited by Anvbis (2016-01-06 11:19:18)


One doesn`t simply do simply.

Offline

#10 2016-01-06 11:18:32

Anvbis
Member
Registered: 2015-12-25
Posts: 14

Re: Hotplug bluetooth mouse after turning it off - udev rule

Marked that thread solved too early.
The mouse is still inactive after a power cycle. Looked in every config, but everywhere it seems fine.


One doesn`t simply do simply.

Offline

#11 2016-01-06 12:43:47

Anvbis
Member
Registered: 2015-12-25
Posts: 14

Re: Hotplug bluetooth mouse after turning it off - udev rule

The mouse also turns off automatically after about an hour, though AutoConnectTimeout in /etc/bluetooth/main.conf is set to 0, Pairable- and Discoverable Timeout too.


One doesn`t simply do simply.

Offline

Board footer

Powered by FluxBB