Article 6EWBQ Ask for review - Kernel driver for GameCube Controller adapter + Udev rule priority

Ask for review - Kernel driver for GameCube Controller adapter + Udev rule priority

by
Hinara
from LinuxQuestions.org on (#6EWBQ)
Hi,

It's my first time on this forum.
I made my first kernel driver for the GameCube Controller adapter of Nintendo
I would like to know if some people who work regularly with kernel modules have a few tips to improve my code or maybe some mistake I made, it might contains some race condition.

Also does someone know if it is possible to prioritize my module to usbhid (if possible without udev rules)?
because it force me to unbind the controller from usbhid and rebind it on my driver each time I plug my adapter
Apparently it is because I made an USB driver which is considered less specilized than usbhid
However the controller does not really support correctly the usbhid interface, or the usbhid is missing something has lsusb say that there is no descriptor report

Code:Bus 001 Device 009: ID 057e:0337 Nintendo Co., Ltd Wii U GameCube Controller Adapter
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x057e Nintendo Co., Ltd
idProduct 0x0337 Wii U GameCube Controller Adapter
bcdDevice 1.00
iManufacturer 1 Nintendo
iProduct 2 WUP-028
iSerial 3 15/07/2014
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0029
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 214
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0025 1x 37 bytes
bInterval 8
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0005 1x 5 bytes
bInterval 8
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0003
Self Powered
Remote Wakeup Enabled
Code repository:
https://github.com/Hinara/gamecube-adapter

Source used to develop it:
https://github.com/ToadKing/wii-u-gc-adapter
Dolphin
Linux Kernel source code especially xpad.c
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments