b-em icon indicating copy to clipboard operation
b-em copied to clipboard

USB Keyboard Build Error

Open sharpie7 opened this issue 4 years ago • 4 comments

Thanks for an amazing project. I mentioned this on the star-dot forum, but maybe it was missed.

I am having trouble building the USB support version on a new-installed OS on a Pi4.

Without the USB keyboard it works fine. However, when I try and make with the USB keyboard support added I get this error:

/home/pi/b-em/src/pico/usb_host_hid/usb_host_hid.c:31:10: fatal error: bsp/board.h: No such file or directory
 #include "bsp/board.h"
          ^~~~~~~~~~~~~

Possibly a missing dependency or bad path somewhere? There doesn't seem to be a board.h file in the listed dependencies, so I am guessing the former. Any advice? Thanks.

sharpie7 avatar Jan 08 '22 16:01 sharpie7

On further examination, I believe the missing library is tinyusb, but I am not sure how to configure and incorporate it in this project.

sharpie7 avatar Jan 15 '22 17:01 sharpie7

Progress of a kind: it seems you need to manually clone tinyusb in to pico-sdk/lib. Then the make finds the tinyusb install. However, there seems to be a version incompatibility problem due to changes in the API. I tried stepping tinyusb back to commit e0aa405 which might be the version this was originally built against, but even that still has problems.

sharpie7 avatar Jan 15 '22 22:01 sharpie7

I have updated the code to use the latest tinyusb release and it is working on my Pico. I will do some more tweaks and upload to a GitHub fork in a few days.

sharpie7 avatar Jan 18 '22 20:01 sharpie7

I have added an experimental branch on my fork which will build against the new tinyusb API.

**NOTE: This version seems to compile OK using the latest 'master' branch of tinyusb as at 2022-01-22 and will run, but does exhibit a number of problems: **

  • Occasionally the wrong modifier keys will be detected which causes odd behaviour, including the on-screen menu appearing randomly
  • Keybaord operations (particularly mounting and unmounting) creates glitches in the emulation due to overload
  • Updating the keyboard LEDs does not work for reasons I can't figure out!
  • Keyboards with external or built-in hubs are not supported

The problem with modifier keys is odd and seems to originate in wrong values reported over the tinyusb API. However, I am unable to reproduce it outside of this application so I assume it is an interaction between this app and tinyusb. Either way, I am not currently able to make progress on fixing it. If anyone has expertise to help then please drop me a note.

sharpie7 avatar Jan 22 '22 14:01 sharpie7