todbot / hidapitester

Simple command-line program to test HIDAPI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding FreeBSD support

mcuee opened this issue · comments

commented

I am able to get hidapitester working under FreeBSD but I am not good at modifying the Makefile.

uname --> FreeBSD
CC --> cc (FreeBSD clang)
LIBS --> -lusb -lpthread (FreeBSD libusb-1.0 needs to link with -lusb)

Packages to install in order to build (libusb-1.0 is part of FreeBSD base OS, so no need to install)

  1. cmake
  2. MAKE --> gmake
  3. pkg-config --> part of pkgconf package

I can use the following command line to build under FreeBSD.

cc -o hidapitester -I ../hidapi/hidapi ../hidapi/libusb/hid.c hidapitester.c -lusb -lpthread
commented

The binary is working.
Ref: libusb/hidapi#407 (comment)

mcuee@freebsdx64vm:~/build/hidapitester $ sudo ./hidapitester --vidpid 0925:7001  -l 3 --open --send-output 2,2,3 --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 02 03
Reading 3-byte input report 0, 250 msec timeout...read 3 bytes:
 01 02 03
Closing device
mcuee@freebsdx64vm:~/build/hidapitester $ sudo ./hidapitester --vidpid 0925:7001  -l 4 --open --send-feature 3,4,5,6 --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 4-byte feature report...wrote 4 bytes:
 03 04 05 06
Reading 4-byte feature report, report_id 4...read 3 bytes:
 04 04 05 00
Closing device

I think I added freebsd support. Let me know if there are any issues. Thank you for being patient. I've not been at my normal bench to test HID stuff.

commented

Yes the latets git works.

mcuee@freebsdx64vm:/usr/home/mcuee/build/hidapitester $ gmake
cc -I/usr/local/include -I ../hidapi/hidapi -c ../hidapi/libusb/hid.c -o ../hidapi/libusb/hid.o
cc -I/usr/local/include -I ../hidapi/hidapi -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi/hidapi ../hidapi/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread