Skip to content

WIP: Support for OpenBSD - #31

Closed
z3ntu wants to merge 2 commits into
libusb:masterfrom
z3ntu:openbsd
Closed

z3ntu wants to merge 2 commits into
libusb:masterfrom
z3ntu:openbsd

Conversation

@z3ntu

@z3ntu z3ntu commented Jun 20, 2019

Copy link
Copy Markdown
Collaborator

OpenBSD currently have a patchset on hidapi in their repos but it was pretty unusable for upstream.

This is proper support for OpenBSD and it compiles: https://builds.sr.ht/~z3ntu/job/70849 . Should be tested with an actual application as well.

An interesting note from the OpenBSD ports:

rename hid_init() to hidapi_hid_init() to avoid collision with usbhid

What they mean is that a library in OpenBSD https://man.openbsd.org/usbhid.3 already has the name hid_init. No idea how that can be solved cleanly.

@Youw

Youw commented Jun 20, 2019

Copy link
Copy Markdown
Member

We could have an inline wrapper hid_init over hidapi_hid_init
That would make it source compatible with all projects
To keep binary compatibility - maybe enable hidapi_hid_init and its wrapper only, when built on BSD

This is the best what I could think of right now

z3ntu added 2 commits July 3, 2019 14:18
An interesting note from the openbsd ports:

rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
@mcuee

mcuee commented Dec 11, 2019 •

Copy link
Copy Markdown
Member

To be honest, using libusb backend for HID device under NetBSD/OpenBSD are not that helpful as it is not easy to use the libusb to replace the HID driver. It will be good to use native HID api.

@mcuee

mcuee commented Dec 11, 2019

Copy link
Copy Markdown
Member

Take note this is different from FreeBSD case. Back in 2012 I did tested quite a bit of FreeBSD USB stuff including HIDAPI as the USB stack allows generic driver along with HID driver for generic HID device.

@mcuee mcuee added the bsd FreeBSD, NetBSD, OpenBSD, etc label Dec 11, 2020
@mcuee

mcuee commented Jun 15, 2021 •

Copy link
Copy Markdown
Member

Reference:
http://www.apcupsd.com/manual/manual.html#bsd-usb-configuration

Users of OpenBSD, NetBSD, and some versions of FreeBSD will need to rebuild the kernel in
order to enable the ugen driver and disable the uhid driver. uhid is not sufficient for 
apcupsd at this time and we need to prevent it from grabbing the UPS device. You should
make the following changes to your kernel config file:

FreeBSD (v5.4 and below, v6.0)
(you will not lose use of USB keyboard and mouse)
Disable: uhid
Enable: ugen
FreeBSD (v5.5, v6.1 and above)
(you will not lose use of USB keyboard and mouse)
Disable: (nothing)
Enable: ugen
This is the default configuration for a GENERIC kernel on many platforms so you most likely 
will not need to recompile.

NetBSD (v3.x and below)
(you will lose use of USB keyboard and mouse)
Disable: uhidev, ums, wsmouse, ukbd, wskbd, uhid
Enable: ugen
NetBSD (v4.0 and above)
You can use apcupsd on single USB port without disabling the USB keyboard and mouse on 
other ports, though all other devices will be disabled on the port you pick for your UPS.

OpenBSD
(you will lose use of USB keyboard and mouse):
Disable: uhidev, ums, wsmouse, ukbd, wskbd, uhid
Enable: ugen

@Youw

Youw commented Apr 25, 2022 •

Copy link
Copy Markdown
Member

Youw added a commit that referenced this pull request Sep 10, 2022
NOTES, as described in #31:
- it is still hard to use HIDAPI on OpenBSD since it is hard to use LIBUSB with HID devices;
- there is a name colision with `hid_init` from `usbhid` OpenBSD library;

Closes: #31
@Youw Youw closed this in #449 Sep 10, 2022
Youw added a commit that referenced this pull request Sep 10, 2022
NOTES, as described in #31:
- it is still hard to use HIDAPI on OpenBSD since it is hard to use LIBUSB with HID devices;
- there is a name colision with `hid_init` from `usbhid` OpenBSD library;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bsd FreeBSD, NetBSD, OpenBSD, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants