On Sat, Nov 12, 2022 at 07:24:43PM -0300, Gabriel Oliveira Santos wrote: > Hi! My name is Gabriel Santos and I'm developing a USB driver based on > https://github.com/torvalds/linux/blob/master/drivers/hid/usbhid/usbmouse.c > for a USB joystick. Why are you doing this instead of using the kernel's own joystick drivers? Or modifying one of them to do what you want? Wouldn't that be easier? > I changed the device table to use the joystick's vendor and product > id, like the table in > https://github.com/torvalds/linux/blob/master/drivers/usb/usb-skeleton.c. > > Currently, if I rmmod usbhid, insmod my driver and plug in the > joystick, everything works. But I do need to rmmod usbhid in order for > my driver to be probed. > > Is there a way to make my driver have higher precedence than usbhid, > so I don't need to rmmod usbhid? In short, there is not. When two drivers claim to be able to manage the same device, which one binds to the device is arbitrary. If you want, you can unbind usbhid and bind your driver by hand (or by a script) using sysfs. But that's not the same thing. Alan Stern