Skip to contentSkip to conversation

Extend device driver?

DISCUSSION Pol Eyschen 3 participants 5 messages Sep 10, 2016 – Sep 11, 2016

lore
Share & tools
lore
#0 lore raw

Hi everyone,

I want to implement some custom functions of my mouse (Madcatz RAT5) in Linux, e.g custom DPI-values. As this requires writing over USB to the firmware of the mouse I was thinking of writing a module to accomplish this. However I don't want to reimplement a whole mouse-driver,so I wanted to ask if there is a possibility of binding the device to 2 modules or having my module extend usbhid, so that my module would only be used to perform these custom operations while usbhid stays in charge of the whole "mouse business".

Thanks

Pol

#1 lore raw
Quoted 10 lines · Pol Eyschen

Hi everyone,

I want to implement some custom functions of my mouse (Madcatz RAT5) in Linux, e.g custom DPI-values. As this requires writing over USB to the firmware of the mouse I was thinking of writing a module to accomplish this. However I don't want to reimplement a whole mouse-driver,so I wanted to ask if there is a possibility of binding the device to 2 modules or having my module extend usbhid, so that my module would only be used to perform these custom operations while usbhid stays in charge of the whole "mouse business".

Please just use the hidraw userspace driver/library instead, that way you don't have to unbind the kernel driver and everything should work just fine without having to touch the kernel at all.

Hope this helps,

greg k-h

#2 lore raw

You may want to look at http://www.signal11.us/oss/hidapi/ too, it has nice interface to HID device and supports libusb and hidraw backends
(y)

Regards,

2016-09-10 12:14 GMT-03:00 Greg KH <[email protected]>:

Quoted 24 lines · Pol Eyschen
Quoted 10 lines

Hi everyone,

I want to implement some custom functions of my mouse (Madcatz RAT5) in Linux, e.g custom DPI-values. As this requires writing over USB to the firmware of the mouse I was thinking of writing a module to accomplish this. However I don't want to reimplement a whole mouse-driver,so I wanted to ask if there is a possibility of binding the device to 2 modules or having my module extend usbhid, so that my module would only be used to perform these custom operations while usbhid stays in charge of the whole "mouse business".

Please just use the hidraw userspace driver/library instead, that way you don't have to unbind the kernel driver and everything should work just fine without having to touch the kernel at all.

Hope this helps,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 2 lines
"Do or do not. There is no try"
  Yoda Master
#3 lore raw
In reply to Greg KH
Quoted 12 lines · Greg KH
Quoted 10 lines · Pol Eyschen

Hi everyone,

I want to implement some custom functions of my mouse (Madcatz RAT5) in Linux, e.g custom DPI-values. As this requires writing over USB to the firmware of the mouse I was thinking of writing a module to accomplish this. However I don't want to reimplement a whole mouse-driver,so I wanted to ask if there is a possibility of binding the device to 2 modules or having my module extend usbhid, so that my module would only be used to perform these custom operations while usbhid stays in charge of the whole "mouse business".

Quoted 8 lines

Please just use the hidraw userspace driver/library instead, that way you don't have to unbind the kernel driver and everything should work just fine without having to touch the kernel at all.

Hope this helps,

greg k-h

I looked at hidraw, unfortunately it doesn't work for me, as the mouse expects control URBs with proprietary requests, hence my thought for a kernel module.

#4 lore raw
Quoted 17 lines · Pol Eyschen
Quoted 16 lines · Greg KH
Quoted 10 lines · Pol Eyschen

Hi everyone,

I want to implement some custom functions of my mouse (Madcatz RAT5) in Linux, e.g custom DPI-values. As this requires writing over USB to the firmware of the mouse I was thinking of writing a module to accomplish this. However I don't want to reimplement a whole mouse-driver,so I wanted to ask if there is a possibility of binding the device to 2 modules or having my module extend usbhid, so that my module would only be used to perform these custom operations while usbhid stays in charge of the whole "mouse business".

Please just use the hidraw userspace driver/library instead, that way you don't have to unbind the kernel driver and everything should work just fine without having to touch the kernel at all.

Quoted 8 lines
Quoted 4 lines

Hope this helps,

greg k-h

I looked at hidraw, unfortunately it doesn't work for me, as the mouse expects control URBs with proprietary requests, hence my thought for a kernel module.

Ok, then yes, you need to have a separate kernel driver. Look at one of the many examples of this in the kernel already, this is quite common.

For specific questions about this, I suggest asking on the linux-input mailing list, as that is where the developers of this code live.

good luck!

greg k-h