KMKfw / kmk_firmware

Clackety Keyboards Powered by Python
https://kmkfw.zulipchat.com
Other
1.39k stars 475 forks source link

[BUG] Enabling pan causes error code 10 #1028

Open Glodigit opened 2 weeks ago

Glodigit commented 2 weeks ago

Describe the bug In boot.py, I have added the following:

from kmk.bootcfg import bootcfg
import board
bootcfg(    sense  = board.ROW0,
            source = board.COL0,
            pan    = True,
            )

Unlike enabling nkro, when enabling pan, Windows 10 reports a USB descriptor error: image

This device cannot start. (Code 10)
An unknown item was found in the report descriptor.

Problem Status:
{EXCEPTION}
Illegal Instruction
An attempt was made to execute an illegal instruction.
C000001D

Thus, no HID reports are processed.

To Reproduce Steps to reproduce the behavior:

Debug output If pan is enabled:

Traceback (most recent call last):
  File "kmk/kmk_keyboard.py", line 448, in go
  File "kmk/kmk_keyboard.py", line 483, in _init
  File "kmk/kmk_keyboard.py", line 296, in _init_hid
  File "kmk/hid.py", line 276, in __init__
  File "kmk/hid.py", line 68, in __init__
  File "kmk/hid.py", line 285, in hid_send
OSError: USB busy

If both nkro and pan are enabled:

kmk.hid: use NKRO
kmk.hid: use pan
...
kmk.keyboard: keys_pressed={MouseKey(code=1)}
kmk.hid: send: OSError: USB busy
kmk.keyboard: axes={Axis(code=3, delta=-8)}
kmk.hid: send: OSError: USB busy

Additional context Using

JamesToBoot commented 2 weeks ago

Hey there, Is circuitpython 9x now working? Do you have issues when you use 8x?

Glodigit commented 2 weeks ago

I've never used 8x

JamesToBoot commented 1 week ago

what to give it a try? Most MCUs have 8x available on circuitpython.org/downloads

Glodigit commented 1 week ago

I've got a custom keyboard I reverse engineered. It seems based on a Raspberry Pi Pico. 9.1.2 is the only version I've successfully compiled the .uf2 for, and it took multiple days to get to that point.

I'd also like to add that only enabling NKRO works.

JamesToBoot commented 1 week ago

There are a lot of pi pico clones that are supported by CircuitPython. Attach a pic of your MCU (front and back).

It may be that there is no compiling involved. Just a download and copy.

xs5871 commented 1 week ago

There's no indication that the CircuitPython version is to blame here and there is no reason to suggest a downgrade as the first course of action.

Glodigit commented 1 week ago

I can only get access to the back: image

I'll see if I can get 8.2.10 .uf2 compiled, since I've also been getting MemoryError: memory allocation failed, allocating 1280 bytes recently (it's always 1280 bytes) and one of the v9.0.0 notes is New split-heap internal dynamic storage mechanism. Some CircuitPython programs may fail with MemoryError..

Glodigit commented 1 week ago

8.2.x does not affect the pan bug. (it has fixed MemoryError though) I've also tried 9.1.3 with no change.

claycooper commented 1 week ago

Is this what you're building? Are you using the files they provide or building your own?

Glodigit commented 1 week ago

That's the project page I created where I document my findings.