input: tablet: add Pegasus Notetaker tablet driver
Subsystems (2)
PATCH v5 1/1 input: tablet: add Pegasus Notetaker tablet driver
This adds a driver for the Pegasus Notetaker Pen. When connected, this uses the Pen as an input tablet.
This device was sold in various different brandings, for example
"Pegasus Mobile Notetaker M210",
"Genie e-note The Notetaker",
"Staedtler Digital ballpoint pen 990 01", "IRISnotes Express" or
"NEWLink Digital Note Taker".
Here's an example, so that you know what we are talking about:
http://www.staedtler.com/en/products/ink-writing-instruments/ballpoint-pens/digital-pen-990-01-digital-ballpoint-pen
http://pegatech.blogspot.com/ seems to be a remaining official resource.
This device can also transfer saved (offline recorded handwritten) data and there are userspace programs that do this, see https://launchpad.net/m210
(Well, alternatively there are really fast scanners out there :)
It's *really* fun to use as an input tablet though! So let's support this for everybody.
There's no way to disable the device. When the pen is out of range, we just don't get any URBs and don't do anything.
Like all other mouses or input tablets, we don't use runtime PM.
---
Thanks for reviewing! Dmitry's and Oliver's changes to v4 made it even smaller now. All is tested again and should apply to any recent tree. If not, please just complain.
revision history
================
v5 fix various bugs (thanks Oliver and Dmitry)
v4 use normal work queue instead of a kernel thread (thanks to Oliver Neukum) v3 fix reporting low pen battery and add USB list to CC
v2 minor cleanup (remove unnecessary variables)
v1 initial release
drivers/input/tablet/Kconfig | 15 ++ drivers/input/tablet/Makefile | 1 + drivers/input/tablet/pegasus_notetaker.c | 361 +++++++++++++++++++++++++++++++ 3 files changed, 377 insertions(+) create mode 100644 drivers/input/tablet/pegasus_notetaker.c
drivers/input/tablet/Kconfig +15 -0
@@ -73,6 +73,21 @@ config TABLET_USB_KBTAB To compile this driver as a module, choose M here: the module will be called kbtab. +config TABLET_USB_PEGASUS + tristate "Pegasus Mobile Notetaker Pen input tablet support" + depends on USB_ARCH_HAS_HCD + select USB + help + Say Y here if you want to use the Pegasus Mobile Notetaker, + also known as: + Genie e-note The Notetaker, + Staedtler Digital ballpoint pen 990 01, + IRISnotes Express or + NEWLink Digital Note Taker. + + To compile this driver as a module, choose M here: the + module will be called pegasus_notetaker. + config TABLET_SERIAL_WACOM4 tristate "Wacom protocol 4 serial tablet support" select SERIO
drivers/input/tablet/Makefile +1 -0
@@ -8,4 +8,5 @@ obj-$(CONFIG_TABLET_USB_AIPTEK) += aiptek.o obj-$(CONFIG_TABLET_USB_GTCO) += gtco.o obj-$(CONFIG_TABLET_USB_HANWANG) += hanwang.o obj-$(CONFIG_TABLET_USB_KBTAB) += kbtab.o +obj-$(CONFIG_TABLET_USB_PEGASUS) += pegasus_notetaker.o obj-$(CONFIG_TABLET_SERIAL_WACOM4) += wacom_serial4.o
drivers/input/tablet/pegasus_notetaker.c new file +361 -0
361 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v5 1/1 input: tablet: add Pegasus Notetaker tablet driver
This adds a driver for the Pegasus Notetaker Pen. When connected, this uses the Pen as an input tablet.
This device was sold in various different brandings, for example
"Pegasus Mobile Notetaker M210",
"Genie e-note The Notetaker",
"Staedtler Digital ballpoint pen 990 01", "IRISnotes Express" or
"NEWLink Digital Note Taker".
Here's an example, so that you know what we are talking about:
http://www.genie-online.de/genie-e-note-2/
https://pegatech.blogspot.com/ seems to be a remaining official resource.
This device can also transfer saved (offline recorded handwritten) data and there are userspace programs that do this, see https://launchpad.net/m210
(Well, alternatively there are really fast scanners out there :)
It's *really* fun to use as an input tablet though! So let's support this for everybody.
There's no way to disable the device. When the pen is out of range, we just don't get any URBs and don't do anything.
Like all other mouses or input tablets, we don't use runtime PM.
---
This is *exactly* v5 again, only with updated commit message third-party links that broke in the meantime.
Again, all is tested and should apply to any recent tree. If not, please just complain.
revision history
================
v5 fix various bugs (thanks Oliver and Dmitry)
v4 use normal work queue instead of a kernel thread (thanks to Oliver Neukum) v3 fix reporting low pen battery and add USB list to CC
v2 minor cleanup (remove unnecessary variables)
v1 initial release
drivers/input/tablet/Kconfig | 15 ++ drivers/input/tablet/Makefile | 1 + drivers/input/tablet/pegasus_notetaker.c | 361 +++++++++++++++++++++++++++++++ 3 files changed, 377 insertions(+) create mode 100644 drivers/input/tablet/pegasus_notetaker.c
drivers/input/tablet/Kconfig +15 -0
@@ -73,6 +73,21 @@ config TABLET_USB_KBTAB To compile this driver as a module, choose M here: the module will be called kbtab. +config TABLET_USB_PEGASUS + tristate "Pegasus Mobile Notetaker Pen input tablet support" + depends on USB_ARCH_HAS_HCD + select USB + help + Say Y here if you want to use the Pegasus Mobile Notetaker, + also known as: + Genie e-note The Notetaker, + Staedtler Digital ballpoint pen 990 01, + IRISnotes Express or + NEWLink Digital Note Taker. + + To compile this driver as a module, choose M here: the + module will be called pegasus_notetaker. + config TABLET_SERIAL_WACOM4 tristate "Wacom protocol 4 serial tablet support" select SERIO
drivers/input/tablet/Makefile +1 -0
@@ -8,4 +8,5 @@ obj-$(CONFIG_TABLET_USB_AIPTEK) += aiptek.o obj-$(CONFIG_TABLET_USB_GTCO) += gtco.o obj-$(CONFIG_TABLET_USB_HANWANG) += hanwang.o obj-$(CONFIG_TABLET_USB_KBTAB) += kbtab.o +obj-$(CONFIG_TABLET_USB_PEGASUS) += pegasus_notetaker.o obj-$(CONFIG_TABLET_SERIAL_WACOM4) += wacom_serial4.o
drivers/input/tablet/pegasus_notetaker.c new file +361 -0
361 lines not on this page · raw message
Signature · 1 line
2.1.4
Dmitry Torokhov
maintainerHi Martin,
Quoted 26 lines · Martin Kepplinger
This adds a driver for the Pegasus Notetaker Pen. When connected, this uses the Pen as an input tablet.
This device was sold in various different brandings, for example
"Pegasus Mobile Notetaker M210",
"Genie e-note The Notetaker",
"Staedtler Digital ballpoint pen 990 01", "IRISnotes Express" or
"NEWLink Digital Note Taker".Here's an example, so that you know what we are talking about:
http://www.staedtler.com/en/products/ink-writing-instruments/ballpoint-pens/digital-pen-990-01-digital-ballpoint-penhttp://pegatech.blogspot.com/ seems to be a remaining official resource.
This device can also transfer saved (offline recorded handwritten) data and there are userspace programs that do this, see https://launchpad.net/m210
(Well, alternatively there are really fast scanners out there :)It's *really* fun to use as an input tablet though! So let's support this for everybody.
There's no way to disable the device. When the pen is out of range, we just don't get any URBs and don't do anything.
Like all other mouses or input tablets, we don't use runtime PM.
Quoted 6 lines
Signed-off-by Martin Kepplinger <[email protected]>---
Thanks for reviewing! Dmitry's and Oliver's changes to v4 made it even smaller now. All is tested again and should apply to any recent tree. If not, please just complain.
Couple of minor comments:
drivers/input/tablet/pegasus_notetaker.c line 83
Quoted 4 lines
drivers/input/tablet/pegasus_notetaker.c new file +4
-0+ +static void pegasus_control_msg (struct pegasus *pegasus,u8 *data,int len) +{ +const int sizeof_buf = len *sizeof (u8) +2 ;
Just do "len + 2".
Quoted 13 lines
drivers/input/tablet/pegasus_notetaker.c new file +13
-0+static void pegasus_parse_packet (struct pegasus *pegasus) +{ +unsigned char *data = pegasus->data; +struct input_dev *dev = pegasus->dev; +u16 x, y; + +switch (data[0 ]) { +case SPECIAL_COMMAND : +/* device button pressed */ +if (data[1 ] ==BUTTON_PRESSED ) +schedule_work (&pegasus->init); + +break ;
drivers/input/tablet/pegasus_notetaker.c line 137
Quoted 10 lines
drivers/input/tablet/pegasus_notetaker.c new file +10
-0+/* xy data */ +case BATTERY_LOW : +dev_warn_once (&dev->dev,"Pen battery low\n" ); +case BATTERY_NO_REPORT : +case BATTERY_GOOD : + x =le16_to_cpup ((__le16 *)&data[2 ]); + y =le16_to_cpup ((__le16 *)&data[4 ]); + +/* ignore pen up events */ +if (x ==0 && y ==0 )
Why are we ignoring pen-up events? I'd at least send EV_KEY/BTN_TOOL_PEN/0 and maybe the rest of BTN* events.
Quoted 16 lines
drivers/input/tablet/pegasus_notetaker.c new file +16
-0+break ; + +input_report_key (dev,BTN_TOUCH , data[1 ] &PEN_TIP ); +input_report_key (dev,BTN_RIGHT , data[1 ] &PEN_BUTTON_PRESSED ); +input_report_key (dev,BTN_TOOL_PEN ,1 ); +input_report_abs (dev,ABS_X , (s16 )x); +input_report_abs (dev,ABS_Y , y); + +input_sync (dev); +break ; +default : +dev_warn_once (&pegasus->usbdev->dev, +"unknown answer from device\n" ); + } +} +
drivers/input/tablet/pegasus_notetaker.c line 163
Quoted 10 lines
drivers/input/tablet/pegasus_notetaker.c new file +10
-0+static void pegasus_irq (struct urb *urb) +{ +struct pegasus *pegasus = urb->context; +struct usb_device *dev = pegasus->usbdev; +int retval; + +switch (urb->status) { +case 0 : +pegasus_parse_packet (pegasus); +usb_mark_last_busy (pegasus->usbdev);
Since the driver does not use runtime-PM I do not think you need to call usb_mark_last_busy().
drivers/input/tablet/pegasus_notetaker.c line 222
Quoted 13 lines
drivers/input/tablet/pegasus_notetaker.c new file +13
-0+static int pegasus_probe (struct usb_interface *intf, +const struct usb_device_id *id) +{ +struct usb_device *dev =interface_to_usbdev (intf); +struct usb_endpoint_descriptor *endpoint; +struct pegasus *pegasus; +struct input_dev *input_dev; +int error; +int pipe, maxp; + +/* we control interface 0 */ +if (intf->cur_altsetting->desc.bInterfaceNumber ==1 ) +return -ENODEV ;
Please add:
/* Sanity check that the device has an endpoint */
if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) {
dev_err(&usbinterface->dev, "Invalid number of endpoints\n");
return -EINVAL;
}Thanks.
Signature · 1 line
Dmitry
Hi Dmitry,
Thanks again for your help! Only one comment below...
Am 2016-05-27 um 23:59 schrieb Dmitry Torokhov:
Quoted 21 lines
Hi Martin,
Quoted 18 lines
drivers/input/tablet/pegasus_notetaker.c new file +18
-0+static void pegasus_parse_packet (struct pegasus *pegasus) +{ +unsigned char *data = pegasus->data; +struct input_dev *dev = pegasus->dev; +u16 x, y; + +switch (data[0 ]) { +case SPECIAL_COMMAND : +/* device button pressed */ +if (data[1 ] ==BUTTON_PRESSED ) +schedule_work (&pegasus->init); + +break ; +/* xy data */ +case BATTERY_LOW : +dev_warn_once (&dev->dev,"Pen battery low\n" ); +case BATTERY_NO_REPORT : +case BATTERY_GOOD :
Quoted 8 lines
drivers/input/tablet/pegasus_notetaker.c line 137
Quoted 5 lines
drivers/input/tablet/pegasus_notetaker.c new file +5
-0+ x =le16_to_cpup ((__le16 *)&data[2 ]); + y =le16_to_cpup ((__le16 *)&data[4 ]); + +/* ignore pen up events */ +if (x ==0 && y ==0 )Why are we ignoring pen-up events? I'd at least send EV_KEY/BTN_TOOL_PEN/0 and maybe the rest of BTN* events.
I tried a few things, but I found them not to be useful in our case. To the contrary, they seem to happen at random (or wrongly) too. They seem to be there to seperate lines in drawings or whatever, but I'm not sure exactly when they are valuable.
As an input device I get the best user experience when we ignore them. I don't want them to break "clicking" or the like.