Bluetooth mouse linux windows

Bluetooth mouse linux windows

I prefer the Bluetooth mouse to the wireless USB mouse because I feel USB mouses caused chattering when I used them for more than one year. I don’t see the problem with Bluetooth mouse.

However I had one critical problem to authenticate Bluetooth 4.0 mouse in the dual boot.

After I made a pairing between Bluetooth mouse and MS-Windows 10, rebooted the system, and launched Fedora 27, and made a pairing between the mouse and Fedora, the mouse worked fine.

But after rebooted the system again and launched Windows 10, the Bluetooth mouse didn’t work and I had to make a pairing by reboot.

It seems the Bluetooth authentication saves a unique key in the host and I got how to fix the problem.

0. Make a pairing in Fedora 27

1. Make a pairing in Windows 10

2. Get PsTools to read some secret regedit keys

3. Right click on MS-DOS prompt and launch it with an Administrator privilege

3. PsExec64.exe -s -i regedit

4. Save the “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\$\$

My data is:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\001bdc0e3454\c4be84437bd0]
«LTK»=hex:57,30,62,7c,8d,e8,3b,a5,5c,d1,82,fa,bb,a0,e5,71
«KeyLength»=dword:00000000
«ERand»=hex(b):80,07,0b,e3,63,85,dd,2b
«EDIV»=dword:0000f548
«IRK»=hex:aa,fd,93,6f,05,c3,e7,08,47,70,43,f3,0a,06,df,1a
«Address»=hex(b):d0,6a,43,84,be,c4,00,00
«AddressType»=dword:00000000
«CSRK»=hex:a2,b3,df,00,25,5c,ff,4d,9c,4c,74,06,e2,cb,07,b7
«OutboundSignCounter»=dword:00000000
«AuthReq»=dword:00000001

5. Reboot the system and Launch Fedora 27

6. Modify /var/lib/bluetooth/$/$/info with root

  • If $DEVICE or $ADDRESS is different, you have to move the directory. My path is /var/lib/bluetooth/00:1B:DC:0E:34:54/C4:BE:84:43:7B:D0/info and no problem.
  • Copy LTK in Windows to Key in LongTermKey in Linux with capital characters and no comma
  • Reverse ERand in Windows and convert the hexadecimal without comma to the decimal and paste it to Rand in LongTermKey in Linux. In my case, ERand is 80070be36385dd2b and the reverse is 2bdd8563e30b0780 and the decimal Rand is 3160829177541363584
  • Convert the hexadecimal of EDIV in Windows to the decimal and paste it to EDiv in LongTermKey in Linux. It’s no reverse. In my case, EDIV is f548 and the decimal EDiv is 62792
  • Copy IRK in Windows to Key in IdentifyResolvingKey in Linux with capital characters and no comma
  • Copy CSRK in Windows to Key in LocalSignatureKey in Linux with capital characters and no comma
Читайте также:  Блютуз киа рио 2015 года

7. Run systemctl restart bluetooth with root

My modified /var/lib/bluetooth/00:1B:DC:0E:34:54/C4:BE:84:43:7B:D0/info file is:
[General]
Name=ELECOM Laser Mouse
Appearance=0x03c2
AddressType=public
SupportedTechnologies=LE;
Trusted=true
Blocked=false
Services=00001800-0000-1000-8.
[IdentityResolvingKey]
Key=AAFD936F05C3E708477043F30A06DF1A
[RemoteSignatureKey]
Key=9437CEEC9FD5FEAA30410C1713C6D6CF
Counter=0
Authenticated=false
[LocalSignatureKey]
Key=A2B3DF00255CFF4D9C4C7406E2CB07B7
Counter=0
Authenticated=false
[LongTermKey]
Key=5730627C8DE83BA55CD182FABBA0E571
Authenticated=0
EncSize=16
EDiv=62792
Rand=3160829177541363584
[SlaveLongTermKey]
Key=DA36C669AB37846E1CA15C8A6055912D
Authenticated=0
EncSize=16
EDiv=22299
Rand=4757000163648466617

Then my Bluetooth mouse in dual boot envirinemnt works fine.

Источник

Bluetooth mouse

This article describes configuration & troubleshooting steps specific to Bluetooth mice. The information here builds on the main Bluetooth article, and assumes the user has already followed any installation, configuration, or troubleshooting from that article.

Configuration

Apple Magic Mouse scroll speed

If the scroll speed is too slow, you can try

# modprobe -r hid_magicmouse # modprobe hid_magicmouse scroll_acceleration=1 scroll_speed=55

Scroll speed can be set from 0 to 63.

If the speed suits you, you can make the change permanent in /etc/modprobe.d/

/etc/modprobe.d/hid_magicmouse.conf
options hid_magicmouse scroll_acceleration=1 scroll_speed=55

Apple Magic Mouse middle click

If you find the middle click to be too finicky, you can disable it

# modprobe -r hid_magicmouse # modprobe hid_magicmouse emulate_3button=0

If this setting suits you, you can make the change permantent in /etc/modprobe.d/

/etc/modprobe.d/hid_magicmouse.conf
options hid_magicmouse emulate_3button=0

Mouse pairing and dual boot

When dual booting Windows and Linux, you may find yourself having to re-pair your Bluetooth mouse again and again. This will happen every time you switch OS, because when you pair your device, your Bluetooth service generates a unique set of pairing keys. And the core reason is that the set of pairing keys cannot be shared between the two OS.

First, your computer stores the Bluetooth device’s mac address and pairing key. Second, your Bluetooth device stores your computer’s mac address and the matching key. This usually works fine, but the mac address for your Bluetooth port will be the same on both Linux and Windows (it is set on the hardware level). However, when you re-pair the device in Windows or Linux, it generates a new key. That key overwrites the previously stored key on the Bluetooth device. Windows overwrites the Linux key and vice versa.

To fix the problem, follow the instructions on [1].

if using a Bluetooth LE device use this python script, slightly edited to adapt for arch, originally discussed on [2].

Troubleshooting

Mouse lag

If you experience mouse lag you can try to increase the polling rate. See Mouse polling rate for more information.

You can try to set the minimum/maximum latency for the mouse in BlueZ [3]:

Читайте также:  Произошел неустановленный сбой локального адаптера bluetooth использование адаптера прекращено

Add or modify the following section in /var/lib/bluetooth/mac-of-your-adapter/mac-of-your-mouse/info (adapt the path accordingly):

[ConnectionParameters] MinInterval=6 MaxInterval=9 Latency=44 Timeout=216

Also, you can use hcitool (in bluez-utils-compat AUR ) to change latency parameters of the device:

# HANDLE="$(hcitool con | grep '' | awk '')" # get the device handle # hcitool lecup --handle $HANDLE --latency 0 --min 6 --max 8

Note that this method is only effective for the current connection. If the mouse gets disconnected, you will need to execute again.

Alternatively, you can change the default latency settings via debugfs. See /sys/kernel/debug/bluetooth/hci0/conn__interval> .

This example will solve the lag problems, but you must un pair and pair the mouse:

# echo 0 > /sys/kernel/debug/bluetooth/hci0/conn_latency # echo 6 > /sys/kernel/debug/bluetooth/hci0/conn_min_interval # echo 7 > /sys/kernel/debug/bluetooth/hci0/conn_max_interval

Problems with the USB dongle

If you have trouble with your USB dongle, you may also want to try:

At this point, you should get an hci0 device with:

Sometimes the device is not active right away. Try starting the interface with:

and searching for devices as shown above.

Mouse always disconnects

If the mouse stops working but works again after restarting bluetooth, or the mouse seemingly keeps «falling asleep» after a couple of seconds of inactivity (which is the case for at least some models of Dell XPS 13 [4] [dead link 2022-09-17 ⓘ] ), you may need to disable USB autosuspend for the selected device.

The issue may also lie in the device timeout and HID settings. See #Thinkpad Bluetooth Laser Mouse problems.

If you are using a Logitech device, this issue may be resolved by following the procedure in #Problems with the Logitech BLE mouse (M557, M590, M720, anywhere mouse 2, etc).

Thinkpad Bluetooth Laser Mouse problems

If you are experiencing that your Thinkpad Bluetooth Laser Mouse rapidly connects and then (after a few milliseconds) disconnects again every few seconds (when you move the mouse or press a button), try pairing it with the code 0000 instead pairing without a code.

If the above is unhelpful, the issue may be in the device timeout settings. Edit/create the file /etc/bluetooth/input.conf and apply the following changes:

# Configuration file for the input service # This section contains options which are not specific to any # particular interface [General] # Set idle timeout (in minutes) before the connection will # be disconnect (defaults to 0 for no timeout) IdleTimeout=0 #Enable HID protocol handling in userspace input profile #Defaults to false(hidp handled in hidp kernel module) UserspaceHID=true

These changes will prevent device timeout in order to remain connected. The second setting enables userspace HID handling for bluetooth devices. Restart bluetooth.service to test changes. You also may need a reboot and to re-pair the device.

Читайте также:  Чем отличаются беспроводные наушники от bluetooth

Kensington Expert Wireless Trackball problems

The Kensington Expert Wireless Trackball has default polling rates in the 200ms range, which make it laggy. To fix that, add or modify the [ConnectionParameters] section in /var/lib/bluetooth/mac-of-your-adapter/mac-of-your-mouse/info (adapt the path according to your mouse bluetooth address) as shown above, especially lower the latency to a small number or even 0 .

Problems with the Logitech BLE mouse (M557, M590, M720, anywhere mouse 2, etc)

In some case, the mouse is paired but not moving when used. The device add to be trusted and unblocked. First of all open a terminal and run bluetoothctl

[bluetooth] # remove XX:XX:XX:XX:XX:XX
[bluetooth] # trust XX:XX:XX:XX:XX:XX
[bluetooth] # pair XX:XX:XX:XX:XX:XX
[bluetooth] # connect XX:XX:XX:XX:XX:XX

If the mouse does not work directly, just power off and power on the mouse.

In some cases, it may also be necessary to load the uhid kernel module.

Problems with all BLE mice on kernel 5.9+

See Also

Источник

Bluetooth mouse linux windows

Previously I set up Bluetooth mouse in dual boot of Windows 10 and Fedora using a converter USB to Bluetooth because my laptop didn’t have any Bluetooth devices.

Recently I set up Bluetooth mouse in dual boot of Windows 10 and Fedora 32 in another laptop which has a Bluetooth device and the configuration is a bit different.

Windows 10 recognizes ELECOM M-BT13BL but Fedora 32 does not recognize it in ASUS X545FA and I bought Logicool M337 and Windows 10 and Fedora 32 recognize it.
I don’t know why the format is different from the the previous blog but anyway I succeed to set up Blutotooth mouse in the dual boot.

0. Make a pairing in Fedora 32

1. Make a pairing in Windows 10

2. Get PsTools to read some secret regedit keys

3. Right click on MS-DOS prompt and launch it with an Administrator privilege

3. PsExec64.exe -s -i regedit

4. Save the “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\$\$

My data is:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\c0e434a6159c]
«MasterIRK»=hex:48,5d,82,ad,55,13,23,ed,08,af,46,c7,5e,d0,c7,bf
«34885db3e4bd»=hex:9b,78,96,d8,20,2d,da,a8,0d,1d,bd,75,ab,8e,04,40

5. Reboot the system and Launch Fedora 27

6. Open /var/lib/bluetooth/$/$/info with root and paste the Windows regedit value to “Key” value in [LinkKey] section.

7. Run systemctl restart bluetooth with root

My modified /var/lib/bluetooth/C0:E4:34:A6:15:9C/34:88:5D:B3:E4:Bd/info is
[General]
Name=Bluetooth Mouse M336/M337/M535
Class=0x000580
SupportedTechnologies=BR/EDR;
Trusted=true
Blocked=false
Services=00001000-0000-1000-8000-00805f9b44fb;00001124-0000-1000-8000-00805f9b44fb;00001200-0000-1000-8000-00805f9b34fb;

[LinkKey]
Key=9B7896D8202DDAA80D1DBD75AB8E0440
Type=4
PINLength=0

[DeviceID]
Source=2
Vendor=1133
Product=45078
Version=4611

Then my Bluetooth mouse in dual boot envirinemnt works fine.

Источник

Оцените статью
Adblock
detector