Repository: pwr-Solaar/Solaar

Issue:
K800 keyboard battery status unavailable.
I am using the newest Manjaro x64.

This is the `solaar show` command output:
```
[xxx@xxx-pc ~]$ solaar show
Unifying Receiver
  Device path  : /dev/hidraw0
  USB id       : 046d:c52b
  Serial       : DC279AB2
    Firmware   : 24.07.B0030
    Bootloader : 02.09
    Other      : AA.AC
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=155, 2=181

  1: Wireless Mouse MX Master 2S
     Codename     : MX Master 2S
     Kind         : mouse
     Wireless PID : 4069
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: A6A40064
        Bootloader: BOT 56.10.B0005
          Firmware: MPM 12.10.B0005
          Firmware: MPM 12.10.B0005
             Other: 
     The power switch is located on the base.
     Supports 32 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: unknown:0021           {0021}   
         7: BATTERY STATUS         {1000}   
         8: unknown:1806           {1806}   internal, hidden
         9: CHANGE HOST            {1814}   
        10: REPROG CONTROLS V4     {1B04}   
        11: ADJUSTABLE DPI         {2201}   
        12: VERTICAL SCROLLING     {2100}   
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        13: SMART SHIFT            {2110}   
        14: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert
              Normal wheel motion
            Has ratchet switch
              Normal wheel mode
            High resolution mode
            HID notification
        15: GESTURE 2              {6501}   
        16: unknown:00C2           {00C2}   
        17: unknown:1813           {1813}   internal, hidden
        18: unknown:1830           {1830}   internal, hidden
        19: unknown:1890           {1890}   internal, hidden
        20: unknown:1891           {1891}   internal, hidden
        21: unknown:18A1           {18A1}   internal, hidden
        22: unknown:18C0           {18C0}   internal, hidden
        23: unknown:1DF3           {1DF3}   internal, hidden
        24: unknown:1E00           {1E00}   hidden
        25: unknown:1EB0           {1EB0}   internal, hidden
        26: unknown:1803           {1803}   internal, hidden
        27: unknown:1861           {1861}   internal, hidden
        28: unknown:9001           {9001}   internal, hidden
        29: unknown:9200           {9200}   internal, hidden
        30: unknown:9202           {9202}   internal, hidden
        31: unknown:1805           {1805}   internal, hidden
     Has 8 reprogrammable keys:
         0: LEFT CLICK                , default: LeftClick                   => LEFT CLICK                
             mse, pos:0, group:1, gmask:1
         1: RIGHT CLICK               , default: RightClick                  => RIGHT CLICK               
             mse, pos:0, group:1, gmask:1
         2: MIDDLE BUTTON             , default: MiddleMouseButton           => MIDDLE BUTTON             
             mse, reprogrammable, divertable, pos:0, group:3, gmask:7
         3: BACK AS BUTTON 4          , default: BackEx                      => BACK AS BUTTON 4          
             mse, reprogrammable, divertable, pos:0, group:2, gmask:3
         4: FORWARD AS BUTTON 5       , default: BrowserForwardEx            => FORWARD AS BUTTON 5       
             mse, reprogrammable, divertable, pos:0, group:2, gmask:3
         5: unknown:00C3              , default: unknown:00A9                => unknown:00C3              
             mse, reprogrammable, divertable, pos:0, group:3, gmask:7
         6: unknown:00C4              , default: unknown:009D                => unknown:00C4              
             mse, reprogrammable, divertable, pos:0, group:3, gmask:7
         7: unknown:00D7              , default: unknown:00B4                => unknown:00D7              
             divertable, virtual, pos:0, group:4, gmask:0
     Battery: 20%, discharging.

  2: Wireless Illuminated Keyboard K800
     Codename     : K800
     Kind         : keyboard
     Wireless PID : 406E
     Protocol     : HID++ 4.5
     Polling rate : 20 ms (50Hz)
     Serial number: 636E1413
     The power switch is located on the top right corner.
     Battery status unavailable.
```



Discussion:
Which solaar version are you running? Have you checked if you have the latest firmware? You can update it using `fwupd`. I happen to have the same keyboard (though a different receiver dongle) and it works for me (serial numbers redacted) on Fedora 30:
```
$ rpm -q solaar
solaar-1.0.1-1.fc30.noarch
$ solaar show
Unifying Receiver
  Device path  : /dev/hidraw1
  USB id       : 046d:c52b
  Serial       : AABBCCDD
    Firmware   : 12.08.B0030
    Bootloader : 02.14
    Other      : AA.AA
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=162, 2=161

  1: Wireless Illuminated Keyboard K800
     Codename     : K800
     Kind         : keyboard
     Wireless PID : 2010
     Protocol     : HID++ 1.0
     Polling rate : 20 ms (50Hz)
     Serial number: EEFFDDEE
          Firmware: 22.01.B0019
        Bootloader: 02.01
             Other: 00.07
     The power switch is located on the top right corner.
     Notifications: battery status (0x100000).
     Battery: full, discharging.
[...]
```
Well I updated the firmware, yet nothing changed. 

`fwupdmgr get-devices` output:
```
├─Unifying Receiver:
│     Device ID:           e1aefeab74482e663f7466439b480d4a31994d7b
│     Summary:             A miniaturised USB wireless receiver
│     Current version:     RQR24.11_B0036
│     Bootloader Version:  BOT03.02_B0009
│     Vendor:              Logitech (USB:0x046D)
│     Install Duration:    30 seconds
│     Flags:               updatable|supported|registered
│     GUIDs:               cc4cbfa9-bf9d-540b-b92b-172ce31013c1
│                          279ed287-3607-549e-bacc-f873bb9838c4
│                          15a5fe7c-dfb3-56e1-acec-a014eec38d83
```
`solaar show` output:
```
Unifying Receiver
  Device path  : /dev/hidraw0
  USB id       : 046d:c52b
  Serial       : DC279AB2
    Firmware   : 24.11.B0036
    Bootloader : 02.09
    Other      : AA.AC
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=170, 2=115

  1: Wireless Mouse MX Master 2S
     Codename     : MX Master 2S
     Kind         : mouse
     Wireless PID : 4069
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: A6A40064
        Bootloader: BOT 56.10.B0005
          Firmware: MPM 12.10.B0005
          Firmware: MPM 12.10.B0005
             Other: 
     The power switch is located on the base.
     Supports 32 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: unknown:0021           {0021}   
         7: BATTERY STATUS         {1000}   
         8: unknown:1806           {1806}   internal, hidden
         9: CHANGE HOST            {1814}   
        10: REPROG CONTROLS V4     {1B04}   
        11: ADJUSTABLE DPI         {2201}   
        12: VERTICAL SCROLLING     {2100}   
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        13: SMART SHIFT            {2110}   
        14: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert
              Normal wheel motion
            Has ratchet switch
              Normal wheel mode
            High resolution mode
            HID notification
        15: GESTURE 2              {6501}   
        16: unknown:00C2           {00C2}   
        17: unknown:1813           {1813}   internal, hidden
        18: unknown:1830           {1830}   internal, hidden
        19: unknown:1890           {1890}   internal, hidden
        20: unknown:1891           {1891}   internal, hidden
        21: unknown:18A1           {18A1}   internal, hidden
        22: unknown:18C0           {18C0}   internal, hidden
        23: unknown:1DF3           {1DF3}   internal, hidden
        24: unknown:1E00           {1E00}   hidden
        25: unknown:1EB0           {1EB0}   internal, hidden
        26: unknown:1803           {1803}   internal, hidden
        27: unknown:1861           {1861}   internal, hidden
        28: unknown:9001           {9001}   internal, hidden
        29: unknown:9200           {9200}   internal, hidden
        30: unknown:9202           {9202}   internal, hidden
        31: unknown:1805           {1805}   internal, hidden
     Has 8 reprogrammable keys:
         0: LEFT CLICK                , default: LeftClick                   => LEFT CLICK                
             mse, pos:0, group:1, gmask:1
         1: RIGHT CLICK               , default: RightClick                  => RIGHT CLICK               
             mse, pos:0, group:1, gmask:1
         2: MIDDLE BUTTON             , default: MiddleMouseButton           => MIDDLE BUTTON             
             mse, reprogrammable, divertable, pos:0, group:3, gmask:7
         3: BACK AS BUTTON 4          , default: BackEx                      => BACK AS BUTTON 4          
             mse, reprogrammable, divertable, pos:0, group:2, gmask:3
         4: FORWARD AS BUTTON 5       , default: BrowserForwardEx            => FORWARD AS BUTTON 5       
             mse, reprogrammable, divertable, pos:0, group:2, gmask:3
         5: unknown:00C3              , default: unknown:00A9                => unknown:00C3              
             mse, reprogrammable, divertable, pos:0, group:3, gmask:7
         6: unknown:00C4              , default: unknown:009D                => unknown:00C4              
             mse, reprogrammable, divertable, pos:0, group:3, gmask:7
         7: unknown:00D7              , default: unknown:00B4                => unknown:00D7              
             divertable, virtual, pos:0, group:4, gmask:0
     Battery: 90%, discharging.

  2: Wireless Illuminated Keyboard K800
     Codename     : K800
     Kind         : keyboard
     Wireless PID : 406E
     Protocol     : HID++ 4.5
     Polling rate : 20 ms (50Hz)
     Serial number: 636E1413
     The power switch is located on the top right corner.
     Battery status unavailable.
```
@kgorol  Please, can you provide output of 'solaar -dd show' ?
Are you sure you using latest version of solaar?
@doctor64 of course, there is log from both commands https://gist.github.com/kgorol/d06fed7c5f6c60c25ac727e98a385615

As you see in log I am using version 1.0.1

@kgorol  It's really strange. Please, can you, just for test, unpair mouse from receiver, and perform `solaar -dd show` with only keyboard? I not see commands exchange with keyboard. May be keyboard is switched off?
@kgorol Just noticed - look's like Logitech continue to re-use model numbers. Your K800 have Wireless PID 406E and protocol HID++ 4.5 accordingly to your logs, but @rathann K800 and definition in solaar sources have wpid 2010 and protocol 1.0. We can try to modify sources to add support, but I need your help because I don't have access to hardware.

@doctor64 below is the output after unpairing the mouse :)

```
[kamil@kamil-pc ~]$ solaar -dd show
09:11:45,448    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000]
09:11:45,453    DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03DC279AB20106080000000000000000]
09:11:45,454    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000]
09:11:45,465    DEBUG [MainThread] logitech_receiver.base: (3) => r[20 02 4101 6E401A4000000400000000]
09:11:45,466    DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000]
09:11:45,466    DEBUG [MainThread] logitech_receiver.base: (3) => r[20 02 0100 0000000000000000000000]
09:11:45,466    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300]
09:11:45,466    DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value
09:11:45,466    DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => <UnifyingReceiver(/dev/hidraw0,3)>
09:11:45,546    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 8102 000000]
09:11:45,551    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8102 000100]
Unifying Receiver
  Device path  : /dev/hidraw0
  USB id       : 046d:c52b
  Serial       : DC279AB2
09:11:45,552    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 81F1 010000]
09:11:45,557    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 81F1 012411]
09:11:45,558    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 81F1 020000]
09:11:45,563    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 81F1 020036]
09:11:45,564    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 81F1 040000]
09:11:45,569    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 81F1 040209]
09:11:45,570    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 81F1 030000]
09:11:45,576    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 81F1 03AAAC]
    Firmware   : 24.11.B0036
    Bootloader : 02.09
    Other      : AA.AC
  Has 1 paired device(s) out of a maximum of 6.
09:11:45,576    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 8100 000000]
09:11:45,582    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8100 000900]
  Notifications: wireless, software present (0x000900)
09:11:45,582    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B3 000000]
09:11:45,587    DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B3 00930000000000000000000000000000]
  Device activity counters: 2=147
09:11:45,588    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 8102 000000]
09:11:45,593    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8102 000100]
09:11:45,594    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000]
09:11:45,600    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F83 B50300]
09:11:45,600    DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {83B5}: 3 = invalid value
09:11:45,600    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 040000]
09:11:45,606    DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F83 B50300]
09:11:45,606    DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {83B5}: 3 = invalid value
09:11:45,606    ERROR [MainThread] logitech_receiver.receiver: failed to read Nano wpid for device 1 of <UnifyingReceiver(/dev/hidraw0,3)>
09:11:45,606    ERROR [MainThread] logitech_receiver.receiver: register_new_device
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/logitech_receiver/receiver.py", line 415, in register_new_device
    dev = PairedDevice(self, number, notification)
  File "/usr/lib/python3.7/site-packages/logitech_receiver/receiver.py", line 103, in __init__
    raise _base.NoSuchDevice(number=number, receiver=receiver, error="read Nano wpid")
logitech_receiver.base.NoSuchDevice: {'number': 1, 'receiver': <UnifyingReceiver(/dev/hidraw0,3)>, 'error': 'read Nano wpid'}
09:11:45,607  WARNING [MainThread] logitech_receiver.receiver: <UnifyingReceiver(/dev/hidraw0,3)>: looked for device 1, not found
09:11:45,607    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 210000]
09:11:45,613    DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 210814406E0402010700000000000000]
09:11:45,613    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 410000]
09:11:45,618    DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 41044B38303000000000000000000000]
09:11:45,619     INFO [MainThread] logitech_receiver.receiver: <UnifyingReceiver(/dev/hidraw0,3)>: found new device 2 (406E)

09:11:45,619    DEBUG [MainThread] logitech_receiver.base: (3) pinging device 2
09:11:45,619    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 02 001C 0000F9]
09:11:45,675    DEBUG [MainThread] logitech_receiver.base: (3) => r[11 02 001C 0405F900000000000000000000000000]
  2: Wireless Illuminated Keyboard K800
     Codename     : K800
     Kind         : keyboard
     Wireless PID : 406E
     Protocol     : HID++ 4.5
     Polling rate : 20 ms (50Hz)
09:11:45,675    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 310000]
09:11:45,681    DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 31636E14131A40000007000000000000]
     Serial number: 636E1413
     The power switch is located on the top right corner.
     Battery status unavailable.
```
Of course I will try to help as much as I can.

Resolving patch:
diff --git a/lib/logitech_receiver/descriptors.py b/lib/logitech_receiver/descriptors.py
--- a/lib/logitech_receiver/descriptors.py
+++ b/lib/logitech_receiver/descriptors.py
@@ -215,6 +215,11 @@ def _D(name, codename=None, kind=None, wpid=None, protocol=None, registers=None,
 							_RS.hand_detection(),
 						],
 				)
+_D('Wireless Illuminated Keyboard K800 new', codename='K800 new', protocol=4.5, wpid='406E',
+				settings=[
+							_FS.fn_swap()
+						],
+				)
 _D('Illuminated Living-Room Keyboard K830', protocol=2.0, wpid='4032',
 				settings=[
 							_FS.new_fn_swap()


Test patch: