Skip to contentSkip to conversation

Introduce driver for IMS PCU devices

PATCH In review Dmitry Torokhov 2 participants 5 messages Feb 18, 2013 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

cover Introduce driver for IMS PCU devices

IMS, an In Flight Entertainment System provider, has a number of seat displays Linux. To interact with the user IMS uses a passenger Control Unit (PCU), which communicates with Rave Display Unit via a USB interface.

Originally large part of the PCU handling was done from userspace and so it presents itself as two distinct USB devices: one is a standard HID mouse and another is a CDC-ACM modem-like device. The latter one was used by IMS userspace software to get the status of all PCU buttons and perform other operations. However the fact that with the custom userspace handling the device resides outside of the standard input framework hinders use of the device elsewhere in the stack and this patch series attempts to fix this issue by creating a proper input driver for the device. If the device was purely input device it would also be possible to use cdc-acm + userspace solution and loop the input events back into the kernel via uinput, however the device also allows control its key backlight, which exported as a standard LED device, and this functionality is not available through uinput (nor should it be). Firmware update is also implemented via the standard "request_firmware" mechanism.

The patch series consists of 3 parts:

- a patch adding new keycodes needed for PCU;
- the driver itself;
- a patch to cdc-acm driver to ignore PCU devices when ims-pcu driver is enabled.

Thanks.

Signature · 1 line
Dmitry
author maintainer
#1 lore raw

PATCH 1/3 Input: add new keycodes for passenger control units

Entertainment systems used in aircraft need additional keycodes for their Passenger Control Units, so let's add them.

---
 include/uapi/linux/input.h | 5 +++++
 1 file changed, 5 insertions(+)
include/uapi/linux/input.h +5 -0
index 54a3b49..e6d9609 100644
@@ -702,6 +702,11 @@ struct input_keymap_entry {
 #define KEY_CAMERA_LEFT		0x219
 #define KEY_CAMERA_RIGHT	0x21a
 
+#define KEY_ATTENDANT_ON	0x21b
+#define KEY_ATTENDANT_OFF	0x21c
+#define KEY_ATTENDANT_TOGGLE	0x21d	/* Attendant call on or off */
+#define KEY_LIGHTS_TOGGLE	0x21e	/* Reading light on or off */
+
 #define BTN_TRIGGER_HAPPY		0x2c0
 #define BTN_TRIGGER_HAPPY1		0x2c0
 #define BTN_TRIGGER_HAPPY2		0x2c1
Signature · 1 line
1.7.11.7
author maintainer
#2 lore raw

PATCH 2/3 Input: add IMS Passenger Control Unit driver

In reply to Dmitry Torokhov

The PCU is a device installed in the armrest of a plane seat and is connected to IMS Rave Entertainment System. It has a set of control buttons (Volume Up/Down, Attendant, Lights, etc) on one side and gamepad-like controls on the other side.

Originally the device was handled from userspace and because of that it presents itself on USB bus as a CDC-ACM modem device that however can not make calls. However the custom handling is not as convenient as using standard input subsystem facilities. If it was pure input device it would be possible to continue using userspace solution (moving it over to uinput), but the device also has backlighted keys which can not be supported via uinput.

---
 drivers/input/misc/Kconfig   |   10 +
 drivers/input/misc/Makefile  |    1 +
 drivers/input/misc/ims-pcu.c | 1907 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1918 insertions(+)
 create mode 100644 drivers/input/misc/ims-pcu.c
drivers/input/misc/Kconfig +10 -0
index 798ba29..9d32716 100644
@@ -606,6 +606,16 @@ config INPUT_ADXL34X_SPI
 	  To compile this driver as a module, choose M here: the
 	  module will be called adxl34x-spi.
 
+config INPUT_IMS_PCU
+	tristate "IMS Passenger Control Unit driver"
+	depends on USB
+	depends on LEDS_CLASS
+	help
+	  Say Y here if you have system with IMS Rave Passenger Control Unit.
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called ims_pcu.
+
 config INPUT_CMA3000
 	tristate "VTI CMA3000 Tri-axis accelerometer"
 	help
drivers/input/misc/Makefile +1 -0
index ae5d9fd..33085784 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_INPUT_GP2A)		+= gp2ap002a00f.o
 obj-$(CONFIG_INPUT_GPIO_BEEPER)		+= gpio-beeper.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)	+= gpio_tilt_polled.o
 obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
+obj-$(CONFIG_INPUT_IMS_PCU)		+= ims-pcu.o
 obj-$(CONFIG_INPUT_IXP4XX_BEEPER)	+= ixp4xx-beeper.o
 obj-$(CONFIG_INPUT_KEYSPAN_REMOTE)	+= keyspan_remote.o
 obj-$(CONFIG_INPUT_KXTJ9)		+= kxtj9.o
drivers/input/misc/ims-pcu.c new file +1907 -0

1,907 lines not on this page · raw message

Signature · 1 line
1.7.11.7
author maintainer
#3 lore raw

PATCH 3/3 USB: cdc-acm - blacklist IMS PCU device

In reply to Dmitry Torokhov

The IMS PCU (Passenger Control Unit) device used custom protocol over serial line, so it is presenting itself as CDC ACM device.

Now that we have proper in-kernel driver for it we need to black-list the device in cdc-acm driver.

---
 drivers/usb/class/cdc-acm.c | 13 +++++++++++++
 drivers/usb/class/cdc-acm.h |  1 +
 2 files changed, 14 insertions(+)
drivers/usb/class/cdc-acm.c +13 -0
index 2d92cce..3c8473d 100644
@@ -987,6 +987,10 @@ static int acm_probe(struct usb_interface *intf,
 
 	/* normal quirks */
 	quirks = (unsigned long)id->driver_info;
+
+	if (quirks == IGNORE_DEVICE)
+		return -ENODEV;
+
 	num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR;
 
 	/* handle quirks deadly to normal probing*/
@@ -1691,6 +1695,15 @@ static const struct usb_device_id acm_ids[] = {
 	.driver_info = NO_DATA_INTERFACE,
 	},
 
+#if IS_ENABLED(CONFIG_INPUT_IMS_PCU)
+	{ USB_DEVICE(0x04d8, 0x0082),	/* Application mode */
+	.driver_info = IGNORE_DEVICE,
+	},
+	{ USB_DEVICE(0x04d8, 0x0083),	/* Bootloader mode */
+	.driver_info = IGNORE_DEVICE,
+	},
+#endif
+
 	/* control interfaces without any protocol set */
 	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
 		USB_CDC_PROTO_NONE) },
drivers/usb/class/cdc-acm.h +1 -0
index 35ef887..0f76e4a 100644
@@ -128,3 +128,4 @@ struct acm {
 #define NO_CAP_LINE			4
 #define NOT_A_MODEM			8
 #define NO_DATA_INTERFACE		16
+#define IGNORE_DEVICE			32
Signature · 1 line
1.7.11.7

A message that is not in the archive (sent off-list or not yet received): 1361214357-21205-4-git-send-email-dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Acked-by
#5 lore raw

Re: [PATCH 3/3] USB: cdc-acm - blacklist IMS PCU device

Quoted 7 lines · Dmitry Torokhov

The IMS PCU (Passenger Control Unit) device used custom protocol over serial line, so it is presenting itself as CDC ACM device.

Now that we have proper in-kernel driver for it we need to black-list the device in cdc-acm driver.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html