Re: USB gamepad driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Montag, 18. Oktober 2010, 13:11:01 schrieb Pavlos Vinieratos:
> 
> On 18 ÎÎÏ 2010, at 12:56, Oliver Neukum <oneukum@xxxxxxx> wrote:
> 
> > Am Montag, 18. Oktober 2010, 11:39:19 schrieben Sie:
> >> hello. I am writing a USB gamepad driver for Linux.
> >> I am having problems binding the driver to the device.
> >> should I try libusb?
> >> 
> >> all I want to do is be able to set the LEDs on the gamepad, and get the buttons pressed and print them. 
> > 
> > Generally for input devices it is best to write a kernel driver.
> > Unless the LEDs are on a completely separate interface,
> > you should write a kernel driver.
> > 
> >    HTH
> >        Oliver
> 
> ok. I have a basic kernel driver. I have written the open, probe, disconnect, release, init, exit functions of the module. when I plug the gamepad in, usbhid gets it. I tried to echo the id (5-1:1.0) to the usbhid unbind, and it works.

You should blacklist the device in the HID driver in your finished patch.

> but when I try to echo it to my loaded module's bind, and it says no such device... what is the problem?

Two possibilities.

1. your probe() function is buggy
2. You have not set id_table in your struct usb_driver correctly / not declared MODULE_DEVICE_TABLE

Look at for example drivers/usb/class/cdc-acm.c for how it is done.
 
> is there a way to tell the kernel that my driver should claim the device automatically?

Yes, set id_table and declare MODULE_DEVICE_TABLE. You also need to blacklist
in the hid driver. 

	HTH
		Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux