Implement driver for Topaz signature pads
Subsystems (2)
PATCH 1/1 Implement driver for Topaz signature pads
This patch adds a new driver targeting the T-LBK766SE-BHSB-R. This model is a 320x240 signature pad communicating via USB HID packets. Optionally, it can also communicate over RS-232, but this is not supported in this patch. Enough of the protocol itself is implemented here in order to blit bitmaps and fill rectangles, which is sufficient for an fbcon terminal. In principle, a full framebuffer device could be exposed, but this is not implemented due to performance concerns.
The signature pads, as the name suggests, normally have a pen bundled, which could be exposed as input device. I purchased this device second hand missing the pen, so this aspect of the protocol is neither reverse engineered nor implemented.
At the moment, the driver requires the generic HID device to be disabled in order for probe to be called.
See https://git.rosenzweig.io/?p=libsigpad.git;a=blob;f=protocol.md for a work-in-progress protocol reference.
--- MAINTAINERS | 5 + drivers/hid/Kconfig | 6 ++ drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 3 + drivers/hid/hid-topaz.c | 259 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 274 insertions(+) create mode 100644 drivers/hid/hid-topaz.c
MAINTAINERS +5 -0
@@ -12376,6 +12376,11 @@ T: quilt http://svn.sourceforge.jp/svnroot/tomoyo/trunk/2.5.x/tomoyo-lsm/patches S: Maintained F: security/tomoyo/ +TOPAZ SIGNATURE PAD DRIVER +M: Alyssa Rosenzweig <[email protected]> +S: Odd Fixes +F: drivers/hid/hid-topaz.c + TOPSTAR LAPTOP EXTRAS DRIVER M: Herton Ronaldo Krzesinski <[email protected]> L: [email protected]
drivers/hid/Kconfig +6 -0
@@ -985,6 +985,12 @@ config HID_ALPS Say Y here if you have a Alps touchpads over i2c-hid or usbhid and want support for its special functionalities. +config HID_TOPAZ + tristate "Topaz signature pad HID support" + depends on USB_HID && FB + ---help--- + Support for Topaz signature pads that communicate over USB HID. + endmenu endif # HID
drivers/hid/Makefile +1 -0
@@ -94,6 +94,7 @@ obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o obj-$(CONFIG_HID_TIVO) += hid-tivo.o +obj-$(CONFIG_HID_TOPAZ) += hid-topaz.o obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o
drivers/hid/hid-ids.h +3 -0
@@ -1119,4 +1119,7 @@#define USB_VENDOR_ID_UGTIZER 0x2179#define USB_DEVICE_ID_UGTIZER_TABLET_GP0610 0x0053 +#define USB_VENDOR_ID_TOPAZ 0x06A8 +#define USB_DEVICE_ID_TOPAZ_LBK766 0x0043 +#endif
drivers/hid/hid-topaz.c new file +259 -0
259 lines not on this page · raw message
Signature · 1 line
2.11.0
Jiri Kosina
maintainerQuoted 5 lines · Alyssa Rosenzweig
drivers/hid/hid-topaz.c new file +0
-0
[ ... snip ... ]
drivers/hid/hid-topaz.c line 51
Quoted 11 lines
drivers/hid/hid-topaz.c new file +11
-0+static int topaz_send (struct hid_device *dev,u8 *packet,size_t sz) +{ +int ret; + +u8 *buf =kmemdup (packet, sz,GFP_KERNEL ); + +if (!buf) +return -ENOMEM ; + +if (!dev->ll_driver->output_report) +return -ENODEV ;
Memory pointed to by *buf is leaked here.
Quoted 26 lines
drivers/hid/hid-topaz.c new file +26
-0+static int topazfb_probe (struct hid_device *dev) +{ +struct fb_info *info; +struct topazfb_par *par; + + info =framebuffer_alloc (sizeof (struct topazfb_par ),NULL ); + + par = info->par; + par->hid = dev; + + info->fbops = &topazfb_ops; + info->fix = topazfb_fix; + info->flags =FBINFO_DEFAULT |FBINFO_HWACCEL_IMAGEBLIT + |FBINFO_HWACCEL_FILLRECT ; + +/* this is only a pseudo frame buffer device */ + info->screen_base =NULL ; + info->screen_size =0 ; + +/* LBK766 is 320x240; other models may differ */ + info->var.xres =320 ; + info->var.yres =240 ; + + info->var.bits_per_pixel =1 ; + info->var.grayscale =1 ; + info->var.red.offset =0 ;
drivers/hid/hid-topaz.c line 203
Quoted 10 lines
drivers/hid/hid-topaz.c new file +10
-0+ info->var.red.length =1 ; + info->var.green.offset =0 ; + info->var.green.length =1 ; + info->var.blue.offset =0 ; + info->var.blue.length =1 ; + info->var.transp.offset =0 ; + info->var.transp.length =1 ; + +if (register_framebuffer (info) <0 ) +return -EINVAL ;
Another leak (*info) here?
[ ... snip ... ]
drivers/hid/hid-topaz.c line 244
Quoted 4 lines
drivers/hid/hid-topaz.c new file +4
-0+static const struct hid_device_id topaz_devices[] = { + {HID_USB_DEVICE (USB_VENDOR_ID_TOPAZ ,USB_DEVICE_ID_TOPAZ_LBK766 ) }, + { } +};
You have to add this to hid_have_special_driver[] as well
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs