Repository: pwr-Solaar/Solaar

Issue:
MX Master 3S For Mac shown with a missing name in the GUI device list
**Information**
<!-- Make sure that your issue is not one of the known issues in the Solaar documentation at https://pwr-solaar.github.io/Solaar/ -->
<!-- Do not bother opening an issue for a version older than 1.1.8.  Upgrade to the latest version and see if your issue persists. -->
<!-- If you are not running the current version of Solaar, strongly consider upgrading to the newest version. -->
- Solaar version: solaar 1.1.9
- Distribution: Manjaro Linux
- Kernel version: Linux 6.4.14-1-MANJARO x86_64 GNU/Linux

- Output of `solaar show`:

<details>

```
solaar version 1.1.9

Lightspeed Receiver
  Device path  : /dev/hidraw3
  USB id       : 046d:C539
  Serial       : 8CB99E77
    Firmware   : 39.06.B0040
    Bootloader : 02.09
    Other      : AA.BE
  Has 1 paired device(s) out of a maximum of 1.
  Notifications: wireless, software present (0x000900)
  Device activity counters: (empty)

  1: G502 Gaming Mouse
     Device path  : /dev/hidraw7
     WPID         : 407F
     Codename     : G502
     Kind         : mouse
     Protocol     : unknown (device is offline)
     Polling rate : 8 ms (125Hz)
     Serial number: 784BB265
     The power switch is located on the base.
     Battery: unknown (device is offline).

USB and Bluetooth Devices

  1: MX Master 3S For Mac
     Device path  : /dev/hidraw8
     USB id       : 046d:B034
     Codename     : MX Master 3S Ma
     Kind         : mouse
     Protocol     : HID++ 4.5
     Serial number: 
     Model ID:      B03400000000
     Unit ID:       3B3EB43B
        Bootloader: BL1 69.01.B0006
          Firmware: RBM 22.01.B0006
             Other: 
     Supports 36 HID++ 2.0 features:
         0: ROOT                   {0000} V0     
         1: FEATURE SET            {0001} V0     
         2: DEVICE FW VERSION      {0003} V4     
            Firmware: Bootloader BL1 69.01.B0006 B034BB5190E8
            Firmware: Firmware RBM 22.01.B0006 B034BB5190E8
            Firmware: Other   
            Unit ID: 3B3EB43B  Model ID: B03400000000  Transport IDs: {'btleid': 'B034'}
         3: DEVICE NAME            {0005} V0     
            Name: MX Master 3S For Mac
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B} V0     
         5: CONFIG CHANGE          {0020} V0     
         6: CRYPTO ID              {0021} V1     
         7: DEVICE FRIENDLY NAME   {0007} V0     
            Friendly Name: MX Master 3S Ma
         8: UNIFIED BATTERY        {1004} V3     
            Battery: 60%, discharging.
         9: REPROG CONTROLS V4     {1B04} V5     
            Key/Button Actions (saved): {Left Button:Left Click, Right Button:Right Click, Middle Button:Mouse Middle Button, Back Button:Mouse Back Button, Forward Button:Mouse Forward Button, Mouse Gesture Button:Gesture Button Navigation, Smart Shift:Smart Shift}
            Key/Button Actions        : {Left Button:Left Click, Right Button:Right Click, Middle Button:Mouse Middle Button, Back Button:Mouse Back Button, Forward Button:Mouse Forward Button, Mouse Gesture Button:Gesture Button Navigation, Smart Shift:Smart Shift}
            Key/Button Diversion (saved): {Middle Button:Regular, Back Button:Regular, Forward Button:Regular, Mouse Gesture Button:Regular, Smart Shift:Regular}
            Key/Button Diversion        : {Middle Button:Regular, Back Button:Regular, Forward Button:Regular, Mouse Gesture Button:Regular, Smart Shift:Regular}
        10: CHANGE HOST            {1814} V1     
            Change Host        : 1:XPS13Manjaro
        11: HOSTS INFO             {1815} V2     
            Host 0 (paired): XPS13Manjaro
            Host 1 (paired): MGFold4
            Host 2 (unpaired): 
        12: XY STATS               {2250} V1     
        13: ADJUSTABLE DPI         {2201} V2     
            Sensitivity (DPI) (saved): 1000
            Sensitivity (DPI)        : 1000
        14: SMART SHIFT            {2110} V0     
            Scroll Wheel Ratcheted (saved): Ratcheted
            Scroll Wheel Ratcheted        : Ratcheted
            Scroll Wheel Ratchet Speed (saved): 10
            Scroll Wheel Ratchet Speed        : 10
        15: HIRES WHEEL            {2121} V1     
            Multiplier: 15
            Has invert: Normal wheel motion
            Has ratchet switch: Normal 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
            Scroll Wheel Diversion (saved): False
            Scroll Wheel Diversion        : False
        16: THUMB WHEEL            {2150} V0     
            Thumb Wheel Direction (saved): False
            Thumb Wheel Direction        : False
            Thumb Wheel Diversion (saved): False
            Thumb Wheel Diversion        : False
        17: WHEEL STATS            {2251} V0     
        18: DFUCONTROL             {00C3} V0     
        19: DEVICE RESET           {1802} V0    internal, hidden, unknown:000010 
        20: unknown:1803           {1803} V0    internal, hidden, unknown:000010 
        21: CONFIG DEVICE PROPS    {1806} V8    internal, hidden, unknown:000010 
        22: unknown:1816           {1816} V0    internal, hidden, unknown:000010 
        23: OOBSTATE               {1805} V0    internal, hidden 
        24: unknown:1830           {1830} V0    internal, hidden, unknown:000010 
        25: unknown:1891           {1891} V7    internal, hidden, unknown:000008 
        26: unknown:18A1           {18A1} V0    internal, hidden, unknown:000010 
        27: unknown:1E00           {1E00} V0    hidden 
        28: unknown:1E02           {1E02} V0    internal, hidden 
        29: unknown:1602           {1602} V0     
        30: unknown:1EB0           {1EB0} V0    internal, hidden, unknown:000010 
        31: unknown:1861           {1861} V1    internal, hidden, unknown:000010 
        32: unknown:9300           {9300} V0    internal, hidden, unknown:000010 
        33: unknown:9001           {9001} V0    internal, hidden, unknown:000010 
        34: unknown:1E22           {1E22} V0    internal, hidden, unknown:000010 
        35: unknown:9205           {9205} V0    internal, hidden, unknown:000010 
     Has 8 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Click                
             mse, analytics key events, pos:0, group:1, group mask:g1
             reporting: default
         1: Right Button              , default: Right Click                 => Right Click               
             mse, analytics key events, pos:0, group:1, group mask:g1
             reporting: default
         2: Middle Button             , default: Mouse Middle Button         => Mouse Middle Button       
             mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2
             reporting: default
         3: Back Button               , default: Mouse Back Button           => Mouse Back Button         
             mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2
             reporting: default
         4: Forward Button            , default: Mouse Forward Button        => Mouse Forward Button      
             mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2
             reporting: default
         5: Mouse Gesture Button      , default: Gesture Button Navigation   => Gesture Button Navigation 
             mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2
             reporting: default
         6: Smart Shift               , default: Smart Shift                 => Smart Shift               
             mse, reprogrammable, divertable, raw XY, analytics key events, pos:0, group:2, group mask:g1,g2
             reporting: default
         7: Virtual Gesture Button    , default: Virtual Gesture Button      => Virtual Gesture Button    
             divertable, virtual, raw XY, force raw XY, pos:0, group:3, group mask:empty
             reporting: default
     Battery: 60%, discharging.
```
</details>

- Contents of `~/.config/solaar/config.yaml` (or `~/.config/solaar/config.json` if `~/.config/solaar/config.yaml` not present):

<details>

```
- 1.1.9
- _NAME: MX Master 3S For Mac
  _absent: [hi-res-scroll, lowres-scroll-mode, onboard_profiles, report_rate, pointer_speed, speed-change, backlight, backlight-timed, fn-swap, persistent-remappable-keys,
    disable-keyboard-keys, crown-smooth, divert-crown, divert-gkeys, m-key-leds, mr-key-led, multiplatform, gesture2-gestures, gesture2-divert, gesture2-params,
    sidetone, equalizer, adc_power_management]
  _battery: 4100
  _modelId: B03400000000
  _sensitive: {change-host: false, divert-keys: false, hires-smooth-invert: true, reprogrammable-keys: false, scroll-ratchet: true}
  _unitId: 3B3EB43B
  change-host: null
  divert-keys: {82: 0, 83: 0, 86: 0, 195: 0, 196: 0}
  dpi: 1000
  hires-scroll-mode: false
  hires-smooth-invert: false
  hires-smooth-resolution: true
  reprogrammable-keys: {80: 80, 81: 81, 82: 82, 83: 83, 86: 86, 195: 195, 196: 196}
  scroll-ratchet: 2
  smart-shift: 10
  thumb-scroll-invert: false
  thumb-scroll-mode: false
- _NAME: G502 Gaming Mouse
  _absent: [hi-res-scroll, lowres-scroll-mode, scroll-ratchet, smart-shift, thumb-scroll-invert, thumb-scroll-mode, pointer_speed, speed-change, backlight,
    backlight-timed, fn-swap, reprogrammable-keys, persistent-remappable-keys, divert-keys, disable-keyboard-keys, crown-smooth, divert-crown, divert-gkeys,
    m-key-leds, mr-key-led, multiplatform, change-host, gesture2-gestures, gesture2-divert, gesture2-params, sidetone, equalizer, adc_power_management]
  _battery: 4097
  _sensitive: {hires-scroll-mode: false, hires-smooth-invert: ignore, hires-smooth-resolution: false}
  _serial: 784BB265
  _wpid: 407F
  dpi: 400
  hires-scroll-mode: false
  hires-smooth-invert: false
  hires-smooth-resolution: true
  onboard_profiles: 1
  report_rate: 1

```
</details>


- Errors or warrnings from Solaar:
<!-- Under normal operation Solaar keeps a log of warning and error messages in ~/.tmp
while it is running as a file starting with 'Solaar'.
If this file is not available or does not have useful information you can
run Solaar as `solaar -dd`, after killing any running Solaar processes to
have Solaar log informational, warning, and error messages to stdout. -->


**Describe the bug**
In the Solaar GUI, my MX Master 3S for Mac has a missing name in the device list on the left side. On the right side, the correct name is shown, though (see screenshot).

**To Reproduce**
Steps to reproduce the behavior:
1. Open Solar
2. My Mx Master 3S for Mac is shown as ?? (B034) in the Device List on the left side

**Screenshots**
![image](https://github.com/pwr-Solaar/Solaar/assets/13124998/bdd1b865-cdbb-4773-971a-7acb145ac820)


**Additional context**
Add any other context about the problem here.



Discussion:
This is a timing problem - Solaar requests the name before the device is ready and doesn't update it later.
Can I do something to fix it on my side?

It is not an issue for me. 
I just thought that maybe the Mac Version of this mouse still is not in the system, or something like that.

Please close this issue if this is okay like this from your side.

Resolving patch:
diff --git a/lib/solaar/ui/window.py b/lib/solaar/ui/window.py
--- a/lib/solaar/ui/window.py
+++ b/lib/solaar/ui/window.py
@@ -915,6 +915,8 @@ def update_device(device, item, selected_device_id, need_popup, full=False):
         icon_name = _icons.battery(battery_level, charging)
         _model.set_value(item, _COLUMN.STATUS_ICON, icon_name)
 
+    _model.set_value(item, _COLUMN.NAME, device.codename)
+
     if selected_device_id is None or need_popup:
         select(device.receiver.path if device.receiver else device.path, device.number)
     elif selected_device_id == (device.receiver.path if device.receiver else device.path, device.number):


Test patch: