Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I dont know if there are multiple variant of the keyboard i get this error when trying to get the status #1

Open
PierreCsn opened this issue Jun 1, 2024 · 8 comments

Comments

@PierreCsn
Copy link

❯ ./8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
File "/home/pierre/.local/bin/./8bdkbd", line 8, in
sys.exit(main())
^^^^^^
File "/home/pierre/.local/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
args.func(args)
File "/home/pierre/.local/lib/python3.12/site-packages/eightbdkbd/cli.py", line 120, in cmd_status
print(" Profile name:", kbd.get_profile_name())
^^^^^^^^^^^^^^^^^^^^^^
File "/home/pierre/.local/lib/python3.12/site-packages/eightbdkbd/client.py", line 55, in get_profile_name
raise ValueError(
ValueError: Read unexpected value
Expected: 54800000 or
54801000
Read: 54800c000070006900650072007200650000000000000000000000000000000000

@goncalor
Copy link
Owner

goncalor commented Jun 2, 2024

Hi. Do you always get that error? Do any of the other commands work?

You may try to comment this line (gets profile name) and see if 8bdkbd status works like that.

@electronicgore
Copy link

Hi, I have a similar issue to OP, though with a different code:

$ 8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 120, in cmd_status
    print("    Profile name:", kbd.get_profile_name())
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 55, in get_profile_name
    raise ValueError(
ValueError: Read unexpected value
Expected: 54800000 or
          54801000
    Read: 54e408000000000000000000000000000000000000

Commenting out line 120 in cli.py fixes that, but produces another unexpected value:

$ 8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 123, in cmd_status
    mapped = kbd.get_mapped_keys()
             ^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 66, in get_mapped_keys
    r = self.read_check_start(PROFILE_MAPPED)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 24, in read_check_start
    raise ValueError(
ValueError: Read unexpected start value
Expected: 5481
    Read: 54e408000000000000000000000000000000000000

Trying to create a profile doesn't work either:

$ 8bdkbd profile create profile1
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 138, in cmd_profile_create
    kbd.rename_profile(args.name)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 113, in rename_profile
    self.read_check_start(OK)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 24, in read_check_start
    raise ValueError(
ValueError: Read unexpected start value
Expected: 54e408
    Read: 54e407000000000000000000000000000000000000

These seem to be consistent so far (errors pop up every time, with the same read codes).
Curiously, doing either of the above also disables or, possibly, somehow remaps some buttons (I noticed at least "e" and "windows") until I reconnect the keyboard.

What is inconsistent (and is probably a separate issue, but mentioning it here just in case) is mapping (without creating a profile due to the issue above):

$ 8bdkbd map supera supera
Failed mapping with error: [Errno 110] Operation timed out
Maybe try again?
$ 8bdkbd map supera supera
Failed mapping with error: [Errno 110] Operation timed out
Maybe try again?
$ 8bdkbd map supera supera
Successfully mapped key

@goncalor
Copy link
Owner

Hey @electronicgore. I've seen the protocol "misbehave" (or not act as I expect from reversing) sometimes. From what I remember turning of the keyboard helped reset things. Can you try the following steps please?

  1. pull and install the most recent version of 8bdkbd
  2. set the keyboard power knob to "OFF"
  3. connect the keyboard via USB cable
  4. check status 8bdkbd status . Does it work? Does it fail?
  5. delete any existing profile (8bdkbd profile delete). Does it work?
  6. check status
  7. create a profile (8bdkbd profile create <profile_name>)
  8. check status
  9. try mapping a key (8bdkbd map supera a)
  10. check status
  11. press the profile button on the keyboard (the heart shaped one). It should have its LED on for the profile mappings to work
  12. try to press the supera hardware key to see if it writes "a"

Do you know which firmware version the keyboard is using?

@electronicgore
Copy link

Thanks for the response @goncalor!
I don't know, unfortunately, which firmware version I'm running, and do not have a windows pc at hand to check this. Is there a way to check this from a linux system?

The results of my experiments so far are... weirdly inconsistent:

  • It seems the operations sometimes succeed despite throwing up ValueErrors, but sometimes the changes are persistent and sometimes not.
  • At least some operations disable the e and win buttons (the status check definitely does), and often I can easily reset the keyboard to re-enable them, but sometimes it takes more elaborate procedure (and I'm not too sure on what exactly it is, but I accidentally hit it at least twice).
  • Sometimes these resets involve deleting the profile, so supera becomes no longer bound to a, but now the converse is somehow true - whenever I try to reset everything to defaults (reconnect the keyboard + 8bdbkd profile delete + hold the "fast mapping" key for 5s), supera defaults to a (when a profile is active) even if I tried to remap it to something else.

Here is a console log from one of my early attempts at following the procedure you suggested:

e2@Guildenstern ~ $ 8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 120, in cmd_status
    print("    Profile name:", kbd.get_profile_name())
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 55, in get_profile_name
    raise ValueError(
ValueError: Read unexpected value
Expected: 54800000 or
          54801000
    Read: 5480014142434445464748494a4b4c4d4e4f505152535455565758595a61626364

e2@Guildenstern ~ $ 8bdkbd profile delete
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 144, in cmd_profile_delete
    kbd.delete_profile()
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 104, in delete_profile
    self.read_check_start(OK)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 24, in read_check_start
    raise ValueError(
ValueError: Read unexpected start value
Expected: 54e408
    Read: 54800065666768696a6b6c6d6e6f707172737475767778797a4142434445464748

e2@Guildenstern ~ $ 8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 120, in cmd_status
    print("    Profile name:", kbd.get_profile_name())
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 55, in get_profile_name
    raise ValueError(
ValueError: Read unexpected value
Expected: 54800000 or
          54801000
    Read: 54e408000000000000000000000000000000000000

e2@Guildenstern ~ $ 8bdkbd profile create test
Successfully created profile

e2@Guildenstern ~ $ 8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 120, in cmd_status
    print("    Profile name:", kbd.get_profile_name())
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 55, in get_profile_name
    raise ValueError(
ValueError: Read unexpected value
Expected: 54800000 or
          54801000
    Read: 54e408000000000000000000000000000000000000

e2@Guildenstern ~ $ 8bdkbd map supera a
Successfully mapped key

This output is largely consistent whenever I try to do all steps in one go. One exception is the profile delete operation, which sometimes returns 54e407000000000000000000000000000000000000 and sometimes 54800065666768696a6b6c6d6e6f707172737475767778797a4142434445464748.

Here is another attempt, this time with some resets along the way:

e2@Guildenstern ~ $ 8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 120, in cmd_status
    print("    Profile name:", kbd.get_profile_name())
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 55, in get_profile_name
    raise ValueError(
ValueError: Read unexpected value
Expected: 54800000 or
          54801000
    Read: 5480014142434445464748494a4b4c4d4e4f505152535455565758595a61626364

e2@Guildenstern ~ $ 8bdkbd profile delete
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 144, in cmd_profile_delete
    kbd.delete_profile()
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 104, in delete_profile
    self.read_check_start(OK)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 24, in read_check_start
    raise ValueError(
ValueError: Read unexpected start value
Expected: 54e408
    Read: 54800065666768696a6b6c6d6e6f707172737475767778797a4142434445464748

e2@Guildenstern ~ $ 8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 120, in cmd_status
    print("    Profile name:", kbd.get_profile_name())
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 55, in get_profile_name
    raise ValueError(
ValueError: Read unexpected value
Expected: 54800000 or
          54801000
    Read: 5480014142434445464748494a4b4c4d4e4f505152535455565758595a61626364

# this time I reconnected the keyboard at this point; status output did not change

e2@Guildenstern ~ $ 8bdkbd profile create test
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 138, in cmd_profile_create
    kbd.rename_profile(args.name)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 113, in rename_profile
    self.read_check_start(OK)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 24, in read_check_start
    raise ValueError(
ValueError: Read unexpected start value
Expected: 54e408
    Read: 54e407000000000000000000000000000000000000

e2@Guildenstern ~ $ 8bdkbd status
8BitDo connected: yes
Traceback (most recent call last):
  File "/home/e2/.local/bin/8bdkbd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 71, in main
    args.func(args)
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/cli.py", line 120, in cmd_status
    print("    Profile name:", kbd.get_profile_name())
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/e2/.local/share/pipx/venvs/8bdkbd/lib/python3.12/site-packages/eightbdkbd/client.py", line 55, in get_profile_name
    raise ValueError(
ValueError: Read unexpected value
Expected: 54800000 or
          54801000
    Read: 5480014142434445464748494a4b4c4d4e4f505152535455565758595a61626364

# another disconnect & reconnect; status output same as above

e2@Guildenstern ~ $ 8bdkbd map supera b
Failed mapping with error: [Errno 110] Operation timed out
Maybe try again?

# at this point, supera is mapped to b (despite the error message), but e&win don't work
# disconnect & reconnect enable e&win but reset the supera mapping to a.

Apologies for the long and vague response, I understand it is not very helpful, I'm just really struggling to find any consistency and reproducibility in the keyboard's behavior. :/

@qweryty
Copy link

qweryty commented Sep 27, 2024

I just updated my keyboard to the latest firmware version 1.77 and started getting this error.

ValueError: Read unexpected value
Expected: 54800000 or
          54801000
    Read: 54800800004d00610069006e000000000000000000000000000000000000000000

If I change PROFILE_NAME to PROFILE_NAME = [0x54, 0x80, 0x08, 0x00], status command seems to function correctly, but it seems they changed more things in a protocol.

For example, when I try to map a button it shows the following error:

$ sudo 8bdkbd map supera a
Failed mapping with error: Read unexpected start value
Expected: 54e408
    Read: 548a07010000000000000000000000000000000000000000000000000000000000
Maybe try again?

In spite of that, looks like it successfully remapped the button.

Also, in the changelog it said that they implemented f13-f24 button mapping, but it seems that they used keycodes that are different from usb hid specification.
I tried mapping f24, but instead of expected 0x070073, it used 0x070081
image

@goncalor
Copy link
Owner

Hi @qweryty. Thank you for the comment.

That's interesting. And a pain, if they are changing the protocol...

I understand you were using 8bdkbd already before that upgrade and everything worked fine before? Is that right? Do you know which version you were using before?

@qweryty
Copy link

qweryty commented Nov 3, 2024

Sorry for late reply, I don't check github often.

I don't really remember the firmware version.

At that moment, I just got the keyboard so haven't used 8bdkbd that much, but it was working for some mappings, but I wanted to map some of the less standard f-keys(f13-f24), and found out that those are not implemented yet.

I figured that I could just quickly patch the program, but started having some problems(sorry, no logs), so I thought that a good course of action would be to just update the firmware(especially after reading change logs), but quickly found out that they are changing the protocol.

@KujaQ
Copy link

KujaQ commented Nov 4, 2024

if usb.core.find(idVendor=consts.VENDOR_ID, idProduct=consts.PRODUCT_ID):

At the moment i experience this error, i dont use a USB hub but i think he cant find the Hardware
any ideas to fix it?

Thank you in Advnace :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@qweryty @goncalor @PierreCsn @electronicgore @KujaQ and others