# -*- python-mode -*-
# -*- coding: UTF-8 -*-

## Copyright (C) 2012-2013  Daniel Pavel
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along
## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

## According to Logitech, they use the following product IDs (as of September 2020)
## USB product IDs for receivers: 0xC526 - 0xC5xx
## Wireless PIDs for hidpp10 devices: 0x2006 - 0x2019
## Wireless PIDs for hidpp20 devices: 0x4002 - 0x4097, 0x4101 - 0x4102
## USB product IDs for hidpp20 devices: 0xC07D - 0xC093, 0xC32B - 0xC344
## Bluetooth product IDs (for hidpp20 devices): 0xB012 - 0xB0xx, 0xB32A - 0xB3xx

# USB ids of Logitech wireless receivers.
# Only receivers supporting the HID++ protocol can go in here.

from __future__ import absolute_import, division, print_function, unicode_literals

from .descriptors import DEVICES as _DEVICES
from .i18n import _

# max_devices is only used for receivers that do not support reading from _R.receiver_info offset 0x03, default to 1
# may_unpair is only used for receivers that do not support reading from _R.receiver_info offset 0x03, default to False
# unpair is for receivers that do support reading from _R.receiver_info offset 0x03, no default
## should this last be changed so that may_unpair is used for all receivers? writing to _R.receiver_pairing doesn't seem right
# re_pairs determines whether a receiver pairs by replacing existing pairings, default to False
## currently only one receiver is so marked - should there be more?
# ex100_27mhz_wpid_fix enable workarounds for EX100 and possible other old 27Mhz receivers

_DRIVER = ('hid-generic', 'generic-usb', 'logitech-djreceiver')

_unifying_receiver = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 2,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Unifying Receiver')
}

_nano_receiver = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver'),
    'may_unpair': False,
    're_pairs': True
}

_nano_receiver_no_unpair = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver'),
    'may_unpair': False,
    'unpair': False,
    're_pairs': True
}

_nano_receiver_max2 = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver'),
    'max_devices': 2,
    'may_unpair': False,
    're_pairs': True
}

_nano_receiver_maxn = lambda product_id, max: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver'),
    'max_devices': max,
    'may_unpair': False,
    're_pairs': True
}

_lenovo_receiver = lambda product_id: {
    'vendor_id': 0x17ef,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver')
}

_lightspeed_receiver = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 2,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Lightspeed Receiver')
}

_ex100_receiver = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('EX100 Receiver 27 Mhz'),
    'max_devices': 4,
    'may_unpair': False,
    're_pairs': True,
    'ex100_27mhz_wpid_fix': True
}

# standard Unifying receivers (marked with the orange Unifying logo)
UNIFYING_RECEIVER_C52B = _unifying_receiver(0xc52b)
UNIFYING_RECEIVER_C532 = _unifying_receiver(0xc532)

# Nano receviers that support the Unifying protocol
NANO_RECEIVER_ADVANCED = _nano_receiver(0xc52f)

# ex100 old style receiver pre-unifyimg protocol
EX100_27MHZ_RECEIVER_C517 = _ex100_receiver(0xc517)

# Nano receivers that don't support the Unifying protocol
NANO_RECEIVER_C518 = _nano_receiver(0xc518)
NANO_RECEIVER_C51A = _nano_receiver(0xc51a)
NANO_RECEIVER_C51B = _nano_receiver(0xc51b)
NANO_RECEIVER_C521 = _nano_receiver(0xc521)
NANO_RECEIVER_C525 = _nano_receiver(0xc525)
NANO_RECEIVER_C526 = _nano_receiver(0xc526)
NANO_RECEIVER_C52e = _nano_receiver_no_unpair(0xc52e)
NANO_RECEIVER_C531 = _nano_receiver(0xc531)
NANO_RECEIVER_C534 = _nano_receiver_max2(0xc534)
NANO_RECEIVER_C537 = _nano_receiver(0xc537)
NANO_RECEIVER_6042 = _lenovo_receiver(0x6042)

# Lightspeed receivers
LIGHTSPEED_RECEIVER_C539 = _lightspeed_receiver(0xc539)
LIGHTSPEED_RECEIVER_C53a = _lightspeed_receiver(0xc53a)
LIGHTSPEED_RECEIVER_C53f = _lightspeed_receiver(0xc53f)
LIGHTSPEED_RECEIVER_C53d = _lightspeed_receiver(0xc53d)
LIGHTSPEED_RECEIVER_C545 = _lightspeed_receiver(0xc545)
LIGHTSPEED_RECEIVER_C541 = _lightspeed_receiver(0xc541)
LIGHTSPEED_RECEIVER_C547 = _lightspeed_receiver(0xc547)

ALL = (
    UNIFYING_RECEIVER_C52B,
    UNIFYING_RECEIVER_C532,
    NANO_RECEIVER_ADVANCED,
    EX100_27MHZ_RECEIVER_C517,
    NANO_RECEIVER_C518,
    NANO_RECEIVER_C51A,
    NANO_RECEIVER_C51B,
    NANO_RECEIVER_C521,
    NANO_RECEIVER_C525,
    NANO_RECEIVER_C526,
    NANO_RECEIVER_C52e,
    NANO_RECEIVER_C531,
    NANO_RECEIVER_C534,
    NANO_RECEIVER_C537,
    NANO_RECEIVER_6042,
    LIGHTSPEED_RECEIVER_C539,
    LIGHTSPEED_RECEIVER_C53a,
    LIGHTSPEED_RECEIVER_C53f,
    LIGHTSPEED_RECEIVER_C53d,
    LIGHTSPEED_RECEIVER_C545,
    LIGHTSPEED_RECEIVER_C541,
    LIGHTSPEED_RECEIVER_C547,
)

_wired_device = lambda product_id, interface: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'bus_id': 0x3,
    'usb_interface': interface,
    'isDevice': True
}

_bt_device = lambda product_id: {'vendor_id': 0x046d, 'product_id': product_id, 'bus_id': 0x5, 'isDevice': True}

DEVICES = []

for _ignore, d in _DEVICES.items():
    if d.usbid:
        DEVICES.append(_wired_device(d.usbid, d.interface if d.interface else 2))
    if d.btid:
        DEVICES.append(_bt_device(d.btid))


def other_device_check(bus_id, vendor_id, product_id):
    """Check whether product is a Logitech USB-connected or Bluetooth device based on bus, vendor, and product IDs
    This allows Solaar to support receiverless HID++ 2.0 devices that it knows nothing about"""
    if vendor_id != 0x46d:  # Logitech
        return
    if bus_id == 0x3:  # USB
        if (product_id >= 0xC07D and product_id <= 0xC093 or product_id >= 0xC32B and product_id <= 0xC344):
            return _wired_device(product_id, 2)
    elif bus_id == 0x5:  # Bluetooth
        if (product_id >= 0xB012 and product_id <= 0xB0FF or product_id >= 0xB32A and product_id <= 0xB3FF):
            return _bt_device(product_id)


def product_information(usb_id):
    if isinstance(usb_id, str):
        usb_id = int(usb_id, 16)
    for r in ALL:
        if usb_id == r.get('product_id'):
            return r
    return {}


del _DRIVER, _unifying_receiver, _nano_receiver, _lenovo_receiver, _lightspeed_receiver

lib/logitech_receiver/base_usb.py
# -*- python-mode -*-
# -*- coding: UTF-8 -*-

## Copyright (C) 2012-2013  Daniel Pavel
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along
## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

## According to Logitech, they use the following product IDs (as of September 2020)
## USB product IDs for receivers: 0xC526 - 0xC5xx
## Wireless PIDs for hidpp10 devices: 0x2006 - 0x2019
## Wireless PIDs for hidpp20 devices: 0x4002 - 0x4097, 0x4101 - 0x4102
## USB product IDs for hidpp20 devices: 0xC07D - 0xC093, 0xC32B - 0xC344
## Bluetooth product IDs (for hidpp20 devices): 0xB012 - 0xB0xx, 0xB32A - 0xB3xx

# USB ids of Logitech wireless receivers.
# Only receivers supporting the HID++ protocol can go in here.

from __future__ import absolute_import, division, print_function, unicode_literals

from .descriptors import DEVICES as _DEVICES
from .i18n import _

# max_devices is only used for receivers that do not support reading from _R.receiver_info offset 0x03, default to 1
# may_unpair is only used for receivers that do not support reading from _R.receiver_info offset 0x03, default to False
# unpair is for receivers that do support reading from _R.receiver_info offset 0x03, no default
## should this last be changed so that may_unpair is used for all receivers? writing to _R.receiver_pairing doesn't seem right
# re_pairs determines whether a receiver pairs by replacing existing pairings, default to False
## currently only one receiver is so marked - should there be more?
# ex100_27mhz_wpid_fix enable workarounds for EX100 and possible other old 27Mhz receivers

_DRIVER = ('hid-generic', 'generic-usb', 'logitech-djreceiver')

_unifying_receiver = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 2,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Unifying Receiver')
}

_nano_receiver = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver'),
    'may_unpair': False,
    're_pairs': True
}

_nano_receiver_no_unpair = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver'),
    'may_unpair': False,
    'unpair': False,
    're_pairs': True
}

_nano_receiver_max2 = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver'),
    'max_devices': 2,
    'may_unpair': False,
    're_pairs': True
}

_nano_receiver_maxn = lambda product_id, max: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver'),
    'max_devices': max,
    'may_unpair': False,
    're_pairs': True
}

_lenovo_receiver = lambda product_id: {
    'vendor_id': 0x17ef,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Nano Receiver')
}

_lightspeed_receiver = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 2,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('Lightspeed Receiver')
}

_ex100_receiver = lambda product_id: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'usb_interface': 1,
    'hid_driver': _DRIVER,  # noqa: F821
    'name': _('EX100 Receiver 27 Mhz'),
    'max_devices': 4,
    'may_unpair': False,
    're_pairs': True,
    'ex100_27mhz_wpid_fix': True
}

# standard Unifying receivers (marked with the orange Unifying logo)
UNIFYING_RECEIVER_C52B = _unifying_receiver(0xc52b)
UNIFYING_RECEIVER_C532 = _unifying_receiver(0xc532)

# Nano receviers that support the Unifying protocol
NANO_RECEIVER_ADVANCED = _nano_receiver_no_unpair(0xc52f)

# ex100 old style receiver pre-unifyimg protocol
EX100_27MHZ_RECEIVER_C517 = _ex100_receiver(0xc517)

# Nano receivers that don't support the Unifying protocol
NANO_RECEIVER_C518 = _nano_receiver(0xc518)
NANO_RECEIVER_C51A = _nano_receiver(0xc51a)
NANO_RECEIVER_C51B = _nano_receiver(0xc51b)
NANO_RECEIVER_C521 = _nano_receiver(0xc521)
NANO_RECEIVER_C525 = _nano_receiver(0xc525)
NANO_RECEIVER_C526 = _nano_receiver(0xc526)
NANO_RECEIVER_C52e = _nano_receiver_no_unpair(0xc52e)
NANO_RECEIVER_C531 = _nano_receiver(0xc531)
NANO_RECEIVER_C534 = _nano_receiver_max2(0xc534)
NANO_RECEIVER_C537 = _nano_receiver(0xc537)
NANO_RECEIVER_6042 = _lenovo_receiver(0x6042)

# Lightspeed receivers
LIGHTSPEED_RECEIVER_C539 = _lightspeed_receiver(0xc539)
LIGHTSPEED_RECEIVER_C53a = _lightspeed_receiver(0xc53a)
LIGHTSPEED_RECEIVER_C53f = _lightspeed_receiver(0xc53f)
LIGHTSPEED_RECEIVER_C53d = _lightspeed_receiver(0xc53d)
LIGHTSPEED_RECEIVER_C545 = _lightspeed_receiver(0xc545)
LIGHTSPEED_RECEIVER_C541 = _lightspeed_receiver(0xc541)
LIGHTSPEED_RECEIVER_C547 = _lightspeed_receiver(0xc547)

ALL = (
    UNIFYING_RECEIVER_C52B,
    UNIFYING_RECEIVER_C532,
    NANO_RECEIVER_ADVANCED,
    EX100_27MHZ_RECEIVER_C517,
    NANO_RECEIVER_C518,
    NANO_RECEIVER_C51A,
    NANO_RECEIVER_C51B,
    NANO_RECEIVER_C521,
    NANO_RECEIVER_C525,
    NANO_RECEIVER_C526,
    NANO_RECEIVER_C52e,
    NANO_RECEIVER_C531,
    NANO_RECEIVER_C534,
    NANO_RECEIVER_C537,
    NANO_RECEIVER_6042,
    LIGHTSPEED_RECEIVER_C539,
    LIGHTSPEED_RECEIVER_C53a,
    LIGHTSPEED_RECEIVER_C53f,
    LIGHTSPEED_RECEIVER_C53d,
    LIGHTSPEED_RECEIVER_C545,
    LIGHTSPEED_RECEIVER_C541,
    LIGHTSPEED_RECEIVER_C547,
)

_wired_device = lambda product_id, interface: {
    'vendor_id': 0x046d,
    'product_id': product_id,
    'bus_id': 0x3,
    'usb_interface': interface,
    'isDevice': True
}

_bt_device = lambda product_id: {'vendor_id': 0x046d, 'product_id': product_id, 'bus_id': 0x5, 'isDevice': True}

DEVICES = []

for _ignore, d in _DEVICES.items():
    if d.usbid:
        DEVICES.append(_wired_device(d.usbid, d.interface if d.interface else 2))
    if d.btid:
        DEVICES.append(_bt_device(d.btid))


def other_device_check(bus_id, vendor_id, product_id):
    """Check whether product is a Logitech USB-connected or Bluetooth device based on bus, vendor, and product IDs
    This allows Solaar to support receiverless HID++ 2.0 devices that it knows nothing about"""
    if vendor_id != 0x46d:  # Logitech
        return
    if bus_id == 0x3:  # USB
        if (product_id >= 0xC07D and product_id <= 0xC093 or product_id >= 0xC32B and product_id <= 0xC344):
            return _wired_device(product_id, 2)
    elif bus_id == 0x5:  # Bluetooth
        if (product_id >= 0xB012 and product_id <= 0xB0FF or product_id >= 0xB32A and product_id <= 0xB3FF):
            return _bt_device(product_id)


def product_information(usb_id):
    if isinstance(usb_id, str):
        usb_id = int(usb_id, 16)
    for r in ALL:
        if usb_id == r.get('product_id'):
            return r
    return {}


del _DRIVER, _unifying_receiver, _nano_receiver, _lenovo_receiver, _lightspeed_receiver

lib/logitech_receiver/base_usb.py
diff --git a/docs/usage.md b/docs/usage.md
index c8d0f0311f..560bd4ec59 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -49,23 +49,26 @@ about the selected receiver or device (useful for debugging).
 
 When a receiver is selected in the main window, you can pair a new device by
 clicking on the “Pair new device” button.
-Then turn on the device and it should pair with the receiver if that is possible.
+Then turn on the device and it should pair with the receiver if that is possible
+and the device is not already paired with another active receiver.
 For multi-host devices first select the host position that you want.
 Some Lightspeed devices may pair by pressing a special pairing button.
 
 ![Solaar-main-window-receiver](Solaar-main-window-receiver.png)
 
-Some receivers can only pair with certain kinds of devices, other receivers
-pair a new device by replacing an existing paired device of the same kind,
-and even other receivers can only pair a limited number of times.
+When a device is selected you can unpair the device if your receiver supports
+unpairing. To unpair the device, just click on the “Unpair” button and
+confirm in the window that pops up.
+
 A receiver with the Unifying logo should be able to pair with any device
-with the Unifying logo. If there are no open pairing slots, however, you may
+with the Unifying logo. If there are no open pairing slots, however, you will
 not be able to pair a new device. In this case to pair a new device you
 first need to unpair a device.
 
-When a device is selected you can unpair the device if your receiver supports
-unpairing. To unpair the device, just click on the “Unpair” button and
-confirm in the window that pops up.
+Other receivers can only pair with certain kinds of devices.
+Most of these receivers do not allow unpairing - instead
+pairing a new device replaces an existing paired device of the same kind.
+Some receivers can only pair a limited number of times.
 
 ### Viewing and changing device settings
 
diff --git a/lib/logitech_receiver/base_usb.py b/lib/logitech_receiver/base_usb.py
index a2eec7cbac..2153101803 100644
--- a/lib/logitech_receiver/base_usb.py
+++ b/lib/logitech_receiver/base_usb.py
@@ -126,7 +126,7 @@
 UNIFYING_RECEIVER_C532 = _unifying_receiver(0xc532)
 
 # Nano receviers that support the Unifying protocol
-NANO_RECEIVER_ADVANCED = _nano_receiver(0xc52f)
+NANO_RECEIVER_ADVANCED = _nano_receiver_no_unpair(0xc52f)
 
 # ex100 old style receiver pre-unifyimg protocol
 EX100_27MHZ_RECEIVER_C517 = _ex100_receiver(0xc517)

Cannot unpair logitech mouse from logitech nano receiver
**Information**
- solaar: 1.0.6 (pip3)
- Distribution: ubuntu 21.10
- Kernel version: Linux 5.13.0-16-generic x86_64 GNU/Linux

```
Nano Receiver
  Device path  : /dev/hidraw2
  USB id       : 046d:C52F
  Serial       : BEF9D3BF
    Firmware   : 30.00.B0009
  Has 1 paired device(s) out of a maximum of 1.
  Has 36 successful pairing(s) remaining.
  Notifications: wireless, software present (0x000900)

  1: Marathon Mouse M705 (M-R0073)
     Device path  : /dev/hidraw6
     WPID         : 406D
     Codename     : M705 (M-R0073)
     Kind         : mouse
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: 1967999A
     Model ID:      406D00000000
     Unit ID:       AD21B902
        Bootloader: BOT 59.00.B0002
          Firmware: RQM 67.01.B0005
     The power switch is located on the base.
     Supports 27 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
            Firmware: Bootloader BOT 59.00.B0002 406D5F5048B901
            Firmware: Firmware RQM 67.01.B0005 406D5F5048B901
            Unit ID: AD21B902  Model ID: 406D00000000  Transport IDs: {'wpid': '406D'}
         3: DEVICE NAME            {0005}   
            Name: Marathon Mouse/Performance Plus M705
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: BATTERY STATUS         {1000}   
            Battery: 50%, discharging, next level 20%.
         7: REPROG CONTROLS V4     {1B04}   
            Key/Button Actions (saved): {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '91': 91, '93': 93}
            Key/Button Actions        : {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '91': 91, '93': 93}
         8: POINTER SPEED          {2205}   
            Pointer Speed: 1.0
            Sensitivity (Pointer Speed) (saved): 256
            Sensitivity (Pointer Speed)        : 256
         9: VERTICAL SCROLLING     {2100}   
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        10: DFUCONTROL SIGNED      {00C2}   
        11: DEVICE RESET           {1802}   internal, hidden
        12: unknown:1803           {1803}   internal, hidden
        13: CONFIG DEVICE PROPS    {1806}   internal, hidden
        14: unknown:1810           {1810}   internal, hidden
        15: unknown:1830           {1830}   internal, hidden
        16: unknown:1890           {1890}   internal, hidden
        17: unknown:18A1           {18A1}   internal, hidden
        18: unknown:1DF3           {1DF3}   internal, hidden
        19: unknown:1E00           {1E00}   hidden
        20: unknown:1EB0           {1EB0}   internal, hidden
        21: unknown:1861           {1861}   internal, hidden
        22: unknown:18B1           {18B1}   internal, hidden
        23: unknown:1850           {1850}   internal, hidden
        24: unknown:1F03           {1F03}   internal, hidden
        25: unknown:18C0           {18C0}   internal, hidden
        26: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert: Normal wheel motion
            Has ratchet switch: Free wheel mode
            High resolution mode
            HID notification
            Scroll Wheel Direction (saved): False
            Scroll Wheel Direction        : False
            Scroll Wheel Resolution (saved): True
            Scroll Wheel Resolution        : True
     Has 7 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Click                
             mse, reprogrammable, pos:0, group:1, group mask:g1
             reporting: default
         1: Right Button              , default: Right Click                 => Right Click               
             mse, reprogrammable, pos:0, group:1, group mask:g1
             reporting: default
         2: Middle Button             , default: Mouse Middle Button         => Mouse Middle Button       
             mse, reprogrammable, divertable, pos:0, group:2, group mask:g1,g2
             reporting: default
         3: Back Button               , default: Mouse Back Button           => Mouse Back Button         
             mse, reprogrammable, divertable, pos:0, group:2, group mask:g1,g2
             reporting: default
         4: Forward Button            , default: Mouse Forward Button        => Mouse Forward Button      
             mse, reprogrammable, divertable, pos:0, group:2, group mask:g1,g2
             reporting: default
         5: Left Tilt                 , default: Mouse Scroll Left Button    => Mouse Scroll Left Button  
             mse, reprogrammable, divertable, pos:0, group:2, group mask:g1,g2
             reporting: default
         6: Right Tilt                , default: Mouse Scroll Right Button   => Mouse Scroll Right Button 
             mse, reprogrammable, divertable, pos:0, group:2, group mask:g1,g2
             reporting: default
     Battery: 50%, discharging, next level 20%.
```

**Describe the bug**
Hitting the unpair button has no effect: the mouse remains paired no matter what.
The following error appears the second time I hit the unpair button:
```
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/solaar/ui/window.py", line 201, in _unpair_current_device
    assert bool(device)
AssertionError
```

**Additional context**
Solaar has been installed following the guidelines outlined [here](https://pwr-solaar.github.io/Solaar/installation).

