This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
Replies: 1 comment
-
This is being worked on upstream: https://marc.info/?l=openbsd-tech&m=166123550232089&w=2 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
While this might not be specific to
pico-debug
, debugging withpico-debug
with OpenOCD under OpenBSD might be among the first use-case that raises the issue.ARM microcontrollers are frequently used. Often with tools like J-Link or ST-Link v2.
Instead of using well-known USB protocols like HID or Bulk, these debuggers do not provide a high-level USB interface, and are often recognised by the OS as a raw "generic device", as it is the case under OpenBSD (ugen(4)).
Instead of inventing yet another incompatible interface on top of USB to access the SWD ports,
pico-debug
uses the standard CMSIS-DAP v1 interface, based on top of USB HID (and not the more heavyweight and bloated v2 interface on top of USB Bulk).The device is discovered as an uhid(4) peripheral, and the access is taken over by the driver for the OS to interact with it, like it does for keyboards, mices or any HID.
Problem
While this is an excellent news, it triggers one particular known bug of OpenBSD: there is incomplete support for the external project libusb. There is an OpenBSD back-end on libusb, but it cannot access HID devices directly if the uhid(4) driver is enabled.
Workaround
As explained in the libhidapi package README, libusb will work better with HID devices if OpenBSD does not attach the uhid(4) driver to them, and instead let the exposed as ugen(4) devices.
A radical, but efficient way to do so is to disable the uhid(4) driver altogether with
config(8)
at boot time.This will also disable external mice and keyboard and everything else requiring uhid(4).
If your device is now recognized, it means that this was the origin of the issue.
The long-term solution would be to add an entry to
usb_quirks.c
on the OpenBSD kernel source to prevent it to be attached as a uhid(4) device with the uhid(4) driver still enabled.Links
Beta Was this translation helpful? Give feedback.
All reactions