kamaaina / macropad_tool

tool to program a macropad
50 stars 6 forks source link

config resets after I unplug from USB #27

Open erdanilevicius opened 4 months ago

erdanilevicius commented 4 months ago

Hi, I have similar issue with another macropad tool, basically, I am able to upload the config to my 12key,2knob macropad, but once I unplug the cable and connect it via bluetooth the config resets to previous version. In my case I was able to upload only one good config to the macropad and then every other change to it only changed the first layer when unplugged. After uploading example config and using read command I see that the config is uploaded: image_2024-08-02_140109002

Then I unplug and replug the macro pad to my pc and as you can see the first layer stays the same, but the other 2 layers changes to previous version: image_2024-08-02_140240687

Is there any function int the tool to fully apply changes or will I have to go to a windows and then try the windows tool provided in the google drive?

erdanilevicius commented 4 months ago

The macropad info: usb-devices:

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 16 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1189 ProdID=8842 Rev=01.00
S:  Product=USB Composite Device
S:  SerialNumber=8560134250315036
C:  #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=04(O) Atr=03(Int.) MxPS=  64 Ivl=1ms
E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
I:  If#= 1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=1ms

lsusb -v

Bus 001 Device 019: ID 1189:8842 Acer Communications & Multimedia USB Composite Device
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1189 Acer Communications & Multimedia
  idProduct          0x8842 
  bcdDevice            1.00
  iManufacturer           1 
  iProduct                2 USB Composite Device
  iSerial                 3 8560134250315036
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0042
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      36
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               2.01
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     207
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)
kamaaina commented 3 months ago

thanks for reporting this issue. unfortunately, i do not have a bluetooth capable macropad and thus am unable to test what you are experiencing. however, if you do provide a usb capture from the windows tool, we can integrate this into my tool. that is probably the best way to go about addressing this shortcoming with my software. are you able to provide this?

please understand this software was never intended to support every macropad out there. i also do not intend to purchase every one to fix issues, but if people want to donate one, i'd be willing to invest my time to add support.

erdanilevicius commented 3 months ago

thanks for reporting this issue. unfortunately, i do not have a bluetooth capable macropad and thus am unable to test what you are experiencing. however, if you do provide a usb capture from the windows tool, we can integrate this into my tool. that is probably the best way to go about addressing this shortcoming with my software. are you able to provide this?

please understand this software was never intended to support every macropad out there. i also do not intend to purchase every one to fix issues, but if people want to donate one, i'd be willing to invest my time to add support.

If I've understood you correctly you needed this image_2024-08-07_190811445

Please correct me if I'm wrong.

After I uploaded the config. In this case almost entire 3rd layer is recorded to only write 'H'

kamaaina commented 3 months ago

not quite. i would you to do the following:

  1. connect your device to your computer
  2. start wireshark and capture usb traffic of the bus your device is connected to
  3. start the windows application from the manufacturer
  4. using the manufacturer's software, program your device (keep is simple, but note how keys were programmed; for example, layer 1 key 1 was programmed with 'A', key 2 with 'B', etc)
  5. stop wireshark capture and save the capture
  6. post the capture here
aiac commented 3 months ago

I have a device with the same configuration, 4x3 with two knobs, PID_8842. It behaves the same way—it doesn't remember the button settings for layers 2 and 3 after disconnecting the cable. It does save the buttons for layer 1 and the knobs for each of the layers.

I’ve tried using USB 2.0 and 3.0 ports, a different cable, uploading settings through the port on top of the device and on the side, turning off the LED backlighting, copying assignments from layer 1 to layers 2 and 3, and programming with Bluetooth turned off, but nothing helps.

I also tried using the ch57x-keyboard-tool, but with the same result.

kamaaina commented 3 months ago

@aiac as i stated above, i do not have this device and thus am unable to test/fix. if someone wants to donate this device to me, i can investigate. the other option is to provide me with a wireshark usb capture as i detailed in the comment above yours.

this most likely as nothing to do with usb 2.0/3.9 ports or cables, but rather something my software is not doing and the manufactures software does. unfortunately, until one of the two things above happen, this issue will remain open.

erdanilevicius commented 3 months ago

@kamaaina sorry forgot and had no time to perform the test.
Cant send the capture file from wireshark, so it is zipped here. Here I connected the macropad, opened the windows application and set layer3, 3 keys bellow the 2 knobs for letter A.

As a note I don't know if that makes any difference, but this is performed in a VM with USB passthrough. macropad capture.zip

kamaaina commented 3 months ago

@erdanilevicius thank you i will take a look at what you sent. i assume after you programmed it on the VM with some other software, you unplugged the device and plugged it back in and the configuration on layer3 was still what you set it to. is that correct?

kamaaina commented 3 months ago

could you also post a capture when you used my software to program the same device? it does not have to be done from your VM as your regular host is fine

erdanilevicius commented 3 months ago

@kamaaina

i assume after you programmed it on the VM with some other software, you unplugged the device and plugged it back in and the configuration on layer3 was still what you set it to. is that correct?

Correct, with windows app on VM when I unplug the macropad the config is saved.

could you also post a capture when you used my software to program the same device? it does not have to be done from your VM as your regular host is fine

Had to perform it on VM because for some reason the tool is counted as hidraw device, here you should see when I unplug and plug in the macropad. Use the tool to upload the config where it is edited on same layer 3 buttons to type M. I unplugged and replugged the macropad and the config was back to the previously set by windows tool

sharing the capture of it tool.pcapng.zip

kamaaina commented 3 months ago

@erdanilevicius thanks for providing both captures. the strange part is the 3 keys you programmed with the manufacturer software on windows to 'A' is the same message programmed with my tool to 'M'. so there is something else going on here....

more follow up questions.

  1. after you used the windows software to program to A, did you close/exit the software before you disconnected the macropad?
  2. also, when did you stop the capture? i am wondering if there other messages sent that were not captured. these could be messages that persist the configuration on the macropad, but at this point i am just speculating.
erdanilevicius commented 2 months ago

after you used the windows software to program to A, did you close/exit the software before you disconnected the macropad?

This I actually do not recall If I unplugged the macropad after binding keys with windows tool.

also, when did you stop the capture? i am wondering if there other messages sent that were not captured. these could be messages that persist the configuration on the macropad, but at this point i am just speculating.

This one too ... I will repeat the windows test with the same steps I did with this script and upload a new capture.

erdanilevicius commented 2 months ago

Just redid the configuration on windows tool. During this capture I:

  1. plugged in the macropad
  2. opened the windows tool and programmed same layer 3 buttons from A to M
  3. closed the windows tool, disconnected and then reconnected the macropad again.
  4. Tested if layer 3 buttons stayed on M and they did. Here's the updated capture: macropad.zip
kamaaina commented 2 months ago

thanks for providing the capture. could you please checkout the branch named pid-8842-support to see if that fixes the issue?

erdanilevicius commented 2 months ago

Tested the branch, but I'm getting error on programming it and it is caused by operation time out... It reads the config from the macropad but doesn't upload a new one. I have tested it on my machine and on the VM where I have performed the capture.

kamaaina commented 2 months ago

can you post what you ran and the output?

the only thing that was added to the branch you are testing was sending an additional message after everything was programmed.