Skip to contentSkip to conversation

hid: Logitech G13 driver 0.0.2

PATCH In review [email protected] 3 participants 5 messages Dec 22, 2009 – Jan 6, 2010 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hid: Logitech G13 driver 0.0.2

From: "Rick L. Vinyard Jr." <[email protected]>

This is a driver for the Logitech G13 gamepad, and contains three key parts. In the USB reports the device identifies itself as a HID, and as a result this driver is under the HID framework.

There are two primary sub-components to this driver; an input device and a framebuffer device.

Although identified as a HID, the device does not support standard HID input messages. As a result, a sub-input device is allocated and registered separately in g13_probe(). The raw events are monitored and key presses/joystick activity is reported through the input device after referencing an indexed keymap.

Additionally, this device contains a 160x43 monochrome LCD display. A registered framebuffer device manages this display. The design of this portion of the driver was based on the design of the hecubafb driver with deferred framebuffer I/O since there is no real memory to map.

---

 drivers/hid/Kconfig          |   14 
 drivers/hid/Makefile         |    3 
 drivers/hid/hid-core.c       |    1 
 drivers/hid/hid-g13-logo.xbm |   75 +
 drivers/hid/hid-g13.c        | 1526 +++++++++++++++++++++++++++++++++
 drivers/hid/hid-ids.h        |    1 
 6 files changed, 1620 insertions(+)
drivers/hid/Kconfig renamed from drivers/hid/Kconfig~hid-logitech-g13-driver-002 +14 -0
diff -puN drivers/hid/Kconfig~hid-logitech-g13-driver-002 drivers/hid/Kconfig
@@ -183,6 +183,20 @@ config LOGIRUMBLEPAD2_FF
 	  Say Y here if you want to enable force feedback support for Logitech
 	  Rumblepad 2 devices.
 
+config LOGITECH_G13
+	tristate "Logitech G13 gameboard support"
+	depends on HID_LOGITECH
+	depends on FB
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	select FB_SYS_FOPS
+	help
+	  This provides support for Logitech G13 gameboard
+	  devices. This includes support for the device
+	  as a keypad input with mappable keys as well as
+	  a framebuffer for the LCD display.
+
 config HID_MICROSOFT
 	tristate "Microsoft" if EMBEDDED
 	depends on USB_HID
drivers/hid/Makefile renamed from drivers/hid/Makefile~hid-logitech-g13-driver-002 +3 -0
diff -puN drivers/hid/Makefile~hid-logitech-g13-driver-002 drivers/hid/Makefile
@@ -18,6 +18,9 @@ endif
 ifdef CONFIG_LOGIRUMBLEPAD2_FF
 	hid-logitech-objs	+= hid-lg2ff.o
 endif
+ifdef CONFIG_LOGITECH_G13
+	hid-logitech-objs	+= hid-g13.o
+endif
 
 obj-$(CONFIG_HID_A4TECH)	+= hid-a4tech.o
 obj-$(CONFIG_HID_APPLE)		+= hid-apple.o
drivers/hid/hid-core.c renamed from drivers/hid/hid-core.c~hid-logitech-g13-driver-002 +1 -0
diff -puN drivers/hid/hid-core.c~hid-logitech-g13-driver-002 drivers/hid/hid-core.c
@@ -1325,6 +1325,7 @@ static const struct hid_device_id hid_bl
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G13) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
drivers/hid/hid-g13-logo.xbm new file +75 -0

75 lines not on this page · raw message

drivers/hid/hid-g13.c new file +1526 -0

1,526 lines not on this page · raw message

drivers/hid/hid-ids.h renamed from drivers/hid/hid-ids.h~hid-logitech-g13-driver-002 +1 -0
diff -puN drivers/hid/hid-ids.h~hid-logitech-g13-driver-002 drivers/hid/hid-ids.h
@@ -295,6 +295,7 @@
 #define USB_DEVICE_ID_LOGITECH_EXTREME_3D	0xc215
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2	0xc218
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2	0xc219
+#define USB_DEVICE_ID_LOGITECH_G13		0xc21c
 #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D	0xc283
 #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO	0xc286
 #define USB_DEVICE_ID_LOGITECH_WHEEL	0xc294

_

#1 lore raw
Quoted 20 lines · On Mon, 21 Dec 2009, [email protected] wrote:

From: "Rick L. Vinyard Jr." <[email protected]>

This is a driver for the Logitech G13 gamepad, and contains three key parts. In the USB reports the device identifies itself as a HID, and as a result this driver is under the HID framework.

There are two primary sub-components to this driver; an input device and a framebuffer device.

Although identified as a HID, the device does not support standard HID input messages. As a result, a sub-input device is allocated and registered separately in g13_probe(). The raw events are monitored and key presses/joystick activity is reported through the input device after referencing an indexed keymap.

Additionally, this device contains a 160x43 monochrome LCD display. A registered framebuffer device manages this display. The design of this portion of the driver was based on the design of the hecubafb driver with deferred framebuffer I/O since there is no real memory to map.

Quoted 5 lines

The driver doesn't build for me. Seems like missing some framebuffer-related include at a first glance.

Rick, care to fix that up please?

drivers/hid/hid-g13.c:121: error: field ‘fb_defio’ has incomplete type
drivers/hid/hid-g13.c:1207: error: variable ‘g13_fb_defio’ has initializerbut incomplete type drivers/hid/hid-g13.c:1208: error: unknown field ‘delay’ specified ininitializer drivers/hid/hid-g13.c:1208: warning: excess elements in struct initializer
drivers/hid/hid-g13.c:1208: warning: (near initialization for ‘g13_fb_defio’)
drivers/hid/hid-g13.c:1209: error: unknown field ‘deferred_io’ specified in initializer drivers/hid/hid-g13.c:1209: warning: excess elements in struct initializer
drivers/hid/hid-g13.c:1209: warning: (near initialization for ‘g13_fb_defio’)
drivers/hid/hid-g13.c: In function ‘g13_probe’:drivers/hid/hid-g13.c:1351: error: ‘struct fb_info’ has no member named ‘fbdefio’

Thanks,

Signature · 6 lines
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 33 lines · On Wed, 23 Dec 2009 00:57:43 +0100 (CET) Jiri Kosina <[email protected]> wrote:
Quoted 20 lines · On Mon, 21 Dec 2009, [email protected] wrote:

From: "Rick L. Vinyard Jr." <[email protected]>

This is a driver for the Logitech G13 gamepad, and contains three key parts. In the USB reports the device identifies itself as a HID, and as a result this driver is under the HID framework.

There are two primary sub-components to this driver; an input device and a framebuffer device.

Although identified as a HID, the device does not support standard HID input messages. As a result, a sub-input device is allocated and registered separately in g13_probe(). The raw events are monitored and key presses/joystick activity is reported through the input device after referencing an indexed keymap.

Additionally, this device contains a 160x43 monochrome LCD display. A registered framebuffer device manages this display. The design of this portion of the driver was based on the design of the hecubafb driver with deferred framebuffer I/O since there is no real memory to map.

Quoted 5 lines

The driver doesn't build for me. Seems like missing some framebuffer-related include at a first glance.

Rick, care to fix that up please?

Quoted 10 lines

drivers/hid/hid-g13.c:121: error: field ___fb_defio___ has incomplete type
drivers/hid/hid-g13.c:1207: error: variable ___g13_fb_defio___ has initializerbut incomplete type drivers/hid/hid-g13.c:1208: error: unknown field ___delay___ specified ininitializer
drivers/hid/hid-g13.c:1208: warning: excess elements in struct initializer
drivers/hid/hid-g13.c:1208: warning: (near initialization for ___g13_fb_defio___)
drivers/hid/hid-g13.c:1209: error: unknown field ___deferred_io___ specified in initializer drivers/hid/hid-g13.c:1209: warning: excess elements in struct initializer
drivers/hid/hid-g13.c:1209: warning: (near initialization for ___g13_fb_defio___)
drivers/hid/hid-g13.c: In function ___g13_probe___:drivers/hid/hid-g13.c:1351: error: ___struct fb_info___ has no member named ___fbdefio___

Missing CONFIG_FB_DEFERRED_IO, I assume?

drivers/hid/Kconfig renamed from drivers/hid/Kconfig~hid-logitech-g13-driver-002-fix +1 -0
@@ -187,6 +187,7 @@ config LOGITECH_G13
 	tristate "Logitech G13 gameboard support"
 	depends on HID_LOGITECH
 	depends on FB
+	depends on FB_DEFERRED_IO
 	select FB_SYS_FILLRECT
 	select FB_SYS_COPYAREA
 	select FB_SYS_IMAGEBLIT

_

#3 lore raw
Quoted 16 lines · Andrew Morton
Quoted 10 lines

drivers/hid/hid-g13.c:121: error: field ___fb_defio___ has incomplete type
drivers/hid/hid-g13.c:1207: error: variable ___g13_fb_defio___ has initializerbut incomplete type drivers/hid/hid-g13.c:1208: error: unknown field ___delay___ specified ininitializer
drivers/hid/hid-g13.c:1208: warning: excess elements in struct initializer
drivers/hid/hid-g13.c:1208: warning: (near initialization for ___g13_fb_defio___)
drivers/hid/hid-g13.c:1209: error: unknown field ___deferred_io___ specified in initializer drivers/hid/hid-g13.c:1209: warning: excess elements in struct initializer
drivers/hid/hid-g13.c:1209: warning: (near initialization for ___g13_fb_defio___)
drivers/hid/hid-g13.c: In function ___g13_probe___:drivers/hid/hid-g13.c:1351: error: ___struct fb_info___ has no member named ___fbdefio___

Missing CONFIG_FB_DEFERRED_IO, I assume?

drivers/hid/Kconfig config LOGITECH_G13 · line 190

Quoted 4 lines
drivers/hid/Kconfig renamed from drivers/hid/Kconfig~hid-logitech-g13-driver-002-fix +1 -0
@@ -187,6 +187,7 @@ config LOGITECH_G13
 	tristate "Logitech G13 gameboard support"
 	depends on HID_LOGITECH
 	depends on FB
+	depends on FB_DEFERRED_IO

Indeed, FB_DEFFERED_IO seems to be the culprit for this particular build problem ("select" instead of "depends" might be better here though).

Still, this is not the only build problem of this driver. Apparently it also doesn't like to be built as module (together with all the HID_LOGITECH stuff).

drivers/hid/hid-g13.o:(.rodata+0x1e0): multiple definition of `__mod_hid_device_table' drivers/hid/hid-lg.o:(.rodata+0x540): first defined here
ld: Warning: size of symbol __mod_hid_device_table' changed from 552 in drivers/hid/hid-lg.o to 48 in drivers/hid/hid-g13.o drivers/hid/hid-g13.o: In function g13_init':
/home/jkosina/src/hid/drivers/hid/hid-g13.c:1513: multiple definition of init_module' drivers/hid/hid-lg.o:/home/jkosina/src/hid/drivers/hid/hid-lg.c:354: first defined here drivers/hid/hid-g13.o: In function g13_exit':
/home/jkosina/src/hid/drivers/hid/hid-g13.c:1518: multiple definition of `cleanup_module' drivers/hid/hid-lg.o:/home/jkosina/src/hid/drivers/hid/hid-lg.c:359: first defined here
make[1]: *** [drivers/hid/hid-logitech.o] Error 1

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.
#4 lore raw
Quoted 4 lines · Jiri Kosina

Still, this is not the only build problem of this driver. Apparently it also doesn't like to be built as module (together with all the HID_LOGITECH stuff).

Quoted 17 lines

drivers/hid/hid-g13.o:(.rodata+0x1e0): multiple definition of `__mod_hid_device_table'
drivers/hid/hid-lg.o:(.rodata+0x540): first defined here
ld: Warning: size of symbol __mod_hid_device_table' changed from 552 in drivers/hid/hid-lg.o to 48 in drivers/hid/hid-g13.o drivers/hid/hid-g13.o: In function g13_init':
/home/jkosina/src/hid/drivers/hid/hid-g13.c:1513: multiple definition of `init_module' drivers/hid/hid-lg.o:/home/jkosina/src/hid/drivers/hid/hid-lg.c:354: first defined here
drivers/hid/hid-g13.o: In function `g13_exit':
/home/jkosina/src/hid/drivers/hid/hid-g13.c:1518: multiple definition of `cleanup_module' drivers/hid/hid-lg.o:/home/jkosina/src/hid/drivers/hid/hid-lg.c:359: first defined here
make[1]: *** [drivers/hid/hid-logitech.o] Error 1

Even though the G13 is a Logitech device, perhaps I should break it out of the Logitech stuff. In reality, the "Logitech" option is a bit of a misnomer. It doesn't appear to be Logitech in general but rather Logitech Force Feedback devices.

There's nothing in the driver that needs the Logitech force feedback code.

---

Rick