rb3_driver icon indicating copy to clipboard operation
rb3_driver copied to clipboard

Successfully compiled and ran under Linux after debugging, here's the steps I followed

Open smerkley opened this issue 1 year ago • 2 comments

Hey, I'm pretty new to github and pretty inexperienced at programming in general but with the help of ChatGPT and some troubleshooting I was able to get this to work in my install of Fedora 39. I successfully ran this project years ago in Windows so I thought I'd give it a shot.

First thing I had to do was alter the makefile because it wasn't finding libusb.h (probably something wrong with my setup), this is what mine now looks like:

CFLAGS += -I/usr/include/libusb-1.0
LDLIBS += -lusb-1.0 -lportmidi

all: rb3_driver

rb3_driver: rb3_driver.o myusb_utils.o myusb_atexit.o my_atexit.o
	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS)

Next I found that libusb was running into permissions errors trying to get devices, so I had to run it as root. Then finally the last thing that fixed it was doing libusb_detatch_kernel_driver() before trying to claim the interface, and that solved it! So, on line 236 right before the interface is claimed I added this line:

libusb_detach_kernel_driver(h, interface_number);

And it works great! (though the program could be checking if it needs to detach the kernel driver programmatically but whatever it works!)

Thanks!

smerkley avatar Jan 31 '24 09:01 smerkley

Same for me, created a PR #13

I had to run as root as well.

To succesfully compile on Debian trixie:

CFLAGS=-I/usr/include/libusb-1.0/ make

sphaero avatar Mar 11 '24 09:03 sphaero

To set permissions so you don't need to run as root:

Create a udev rule: /etc/udev/rules.d/11-rb3.rules

SUBSYSTEMS=="usb", ATTRS{product}=="Harmonix RB3 Keyboard for Nintendo Wii", GROUP="users"

Now unplug and re-plug. You now should not need root but just a member of the users group

sphaero avatar Mar 11 '24 09:03 sphaero