From: Ping C. <pin...@gm...> - 2012-05-30 00:09:07
|
On Wed, May 23, 2012 at 7:17 PM, Peter Hutterer <pet...@wh...> wrote: > These two button options specify which button controls which LED bank > exposed by the kernel. > > Signed-off-by: Peter Hutterer <pet...@wh...> > --- > Notably on the Cintiq, the layout of the banks is inverse to what one > expects (0 is right, 1 is left). That can be fixed in the kernel but > long-term it's better to rely on a specific flag to tell us. We may not want to fix it in the kernel. People should not assume 0 is for left. All Cintiqs have 0 for right, so far ;). You may mention Intuos4. But I4 only has one set of LEDs. > Not sure about the 24HD here - three buttons that control the leds? is this > correct? Every LED has its own button. Ping > > data/cintiq-21ux2.tablet | 3 ++ > data/cintiq-24hd.tablet | 3 ++ > data/intuos4-12x19.tablet | 2 ++ > data/intuos4-4x6.tablet | 2 ++ > data/intuos4-6x9-wl.tablet | 2 ++ > data/intuos4-6x9.tablet | 2 ++ > data/intuos4-8x13.tablet | 2 ++ > data/intuos5-m.tablet | 2 ++ > data/intuos5-s.tablet | 2 ++ > data/intuos5-touch-l.tablet | 2 ++ > data/intuos5-touch-m.tablet | 2 ++ > data/intuos5-touch-s.tablet | 2 ++ > data/wacom.example | 5 ++++ > libwacom/libwacom-database.c | 4 ++- > libwacom/libwacom.c | 2 ++ > libwacom/libwacom.h | 2 ++ > test/tablet-validity.c | 63 ++++++++++++++++++++++++++++++++++++++++++ > 17 files changed, 101 insertions(+), 1 deletion(-) > > diff --git a/data/cintiq-21ux2.tablet b/data/cintiq-21ux2.tablet > index 6a0b242..a623f27 100644 > --- a/data/cintiq-21ux2.tablet > +++ b/data/cintiq-21ux2.tablet > @@ -64,3 +64,6 @@ Right=K;L;M;N;J;O;P;Q;R > Touchstrip=A > Touchstrip2=J > StripsNumModes=4 > + > +LED0=J > +LED1=A > diff --git a/data/cintiq-24hd.tablet b/data/cintiq-24hd.tablet > index 004ef22..8c5e715 100644 > --- a/data/cintiq-24hd.tablet > +++ b/data/cintiq-24hd.tablet > @@ -64,3 +64,6 @@ Right=I;J;K;L;M;N;O;P > > Ring=A;B;C > Ring2=I;J;K > + > +LED0=I;J;K > +LED1=A;B;C > diff --git a/data/intuos4-12x19.tablet b/data/intuos4-12x19.tablet > index 4f066b6..c947ef2 100644 > --- a/data/intuos4-12x19.tablet > +++ b/data/intuos4-12x19.tablet > @@ -54,3 +54,5 @@ OLEDs=B;C;D;E;F;G;H;I > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos4-4x6.tablet b/data/intuos4-4x6.tablet > index 36e45d6..e06f08a 100644 > --- a/data/intuos4-4x6.tablet > +++ b/data/intuos4-4x6.tablet > @@ -53,3 +53,5 @@ Left=A;B;C;D;E;F;G > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos4-6x9-wl.tablet b/data/intuos4-6x9-wl.tablet > index 90839de..8468f70 100644 > --- a/data/intuos4-6x9-wl.tablet > +++ b/data/intuos4-6x9-wl.tablet > @@ -54,3 +54,5 @@ OLEDs=B;C;D;E;F;G;H;I > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos4-6x9.tablet b/data/intuos4-6x9.tablet > index 0d20933..3153a81 100644 > --- a/data/intuos4-6x9.tablet > +++ b/data/intuos4-6x9.tablet > @@ -54,3 +54,5 @@ OLEDs=B;C;D;E;F;G;H;I > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos4-8x13.tablet b/data/intuos4-8x13.tablet > index e46e9b4..113a893 100644 > --- a/data/intuos4-8x13.tablet > +++ b/data/intuos4-8x13.tablet > @@ -54,3 +54,5 @@ OLEDs=B;C;D;E;F;G;H;I > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos5-m.tablet b/data/intuos5-m.tablet > index ee3b6bb..79cc636 100644 > --- a/data/intuos5-m.tablet > +++ b/data/intuos5-m.tablet > @@ -63,3 +63,5 @@ Left=A;B;C;D;E;F;G;H;I > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos5-s.tablet b/data/intuos5-s.tablet > index 665159d..f6ba62e 100644 > --- a/data/intuos5-s.tablet > +++ b/data/intuos5-s.tablet > @@ -61,3 +61,5 @@ Left=A;B;C;D;E;F;G > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos5-touch-l.tablet b/data/intuos5-touch-l.tablet > index cbd2685..5c52ecd 100644 > --- a/data/intuos5-touch-l.tablet > +++ b/data/intuos5-touch-l.tablet > @@ -63,3 +63,5 @@ Left=A;B;C;D;E;F;G;H;I > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos5-touch-m.tablet b/data/intuos5-touch-m.tablet > index 4cd57a8..3f627e8 100644 > --- a/data/intuos5-touch-m.tablet > +++ b/data/intuos5-touch-m.tablet > @@ -63,3 +63,5 @@ Left=A;B;C;D;E;F;G;H;I > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/intuos5-touch-s.tablet b/data/intuos5-touch-s.tablet > index 6e3812e..261ec74 100644 > --- a/data/intuos5-touch-s.tablet > +++ b/data/intuos5-touch-s.tablet > @@ -61,3 +61,5 @@ Left=A;B;C;D;E;F;G > > Ring=A > RingNumModes=4 > + > +LED0=A > diff --git a/data/wacom.example b/data/wacom.example > index 762c360..50ac843 100644 > --- a/data/wacom.example > +++ b/data/wacom.example > @@ -144,3 +144,8 @@ Touchstrip2=J > # We assume the same number of modes for each of the touchstrips > # if there is more than one > StripsNumModes=4 > + > +# Button associated with LED bank 0 or 1, i.e. the that should toggle that > +# LED bank > +LED0=A > +LED1=J > diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c > index 5468975..e5569c9 100644 > --- a/libwacom/libwacom-database.c > +++ b/libwacom/libwacom-database.c > @@ -243,7 +243,9 @@ struct { > { "Ring2", WACOM_BUTTON_RING2_MODESWITCH }, > { "Touchstrip", WACOM_BUTTON_TOUCHSTRIP_MODESWITCH }, > { "Touchstrip2", WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH }, > - { "OLEDs", WACOM_BUTTON_OLED } > + { "OLEDs", WACOM_BUTTON_OLED }, > + { "LED0", WACOM_BUTTON_LED0 }, > + { "LED1", WACOM_BUTTON_LED1 } > }; > > static void > diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c > index 482baa5..6306b6b 100644 > --- a/libwacom/libwacom.c > +++ b/libwacom/libwacom.c > @@ -556,6 +556,8 @@ static void print_buttons_for_device (int fd, WacomDevice *device) > print_button_flag_if(fd, device, "OLEDs", WACOM_BUTTON_OLED); > print_button_flag_if(fd, device, "Ring", WACOM_BUTTON_RING_MODESWITCH); > print_button_flag_if(fd, device, "Ring2", WACOM_BUTTON_RING2_MODESWITCH); > + print_button_flag_if(fd, device, "LED0", WACOM_BUTTON_LED0); > + print_button_flag_if(fd, device, "LED1", WACOM_BUTTON_LED1); > dprintf(fd, "RingNumModes=%d\n", libwacom_get_ring_num_modes(device)); > dprintf(fd, "Ring2NumModes=%d\n", libwacom_get_ring2_num_modes(device)); > dprintf(fd, "StripsNumModes=%d\n", libwacom_get_strips_num_modes(device)); > diff --git a/libwacom/libwacom.h b/libwacom/libwacom.h > index f7e6cf9..61b8546 100644 > --- a/libwacom/libwacom.h > +++ b/libwacom/libwacom.h > @@ -159,6 +159,8 @@ typedef enum { > WACOM_BUTTON_TOUCHSTRIP_MODESWITCH = (1 << 7), > WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH = (1 << 8), > WACOM_BUTTON_OLED = (1 << 9), > + WACOM_BUTTON_LED0 = (1 << 10), > + WACOM_BUTTON_LED1 = (1 << 11), > WACOM_BUTTON_MODESWITCH = (WACOM_BUTTON_RING_MODESWITCH | WACOM_BUTTON_RING2_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH), > WACOM_BUTTON_DIRECTION = (WACOM_BUTTON_POSITION_LEFT | WACOM_BUTTON_POSITION_RIGHT | WACOM_BUTTON_POSITION_TOP | WACOM_BUTTON_POSITION_BOTTOM), > WACOM_BUTTON_RINGS_MODESWITCH = (WACOM_BUTTON_RING_MODESWITCH | WACOM_BUTTON_RING2_MODESWITCH), > diff --git a/test/tablet-validity.c b/test/tablet-validity.c > index 38fd0ef..7336b67 100644 > --- a/test/tablet-validity.c > +++ b/test/tablet-validity.c > @@ -55,6 +55,67 @@ static int eraser_is_present(WacomDeviceDatabase *db, const int *styli, int nsty > return 0; > } > > +static void verify_led_bank(WacomDevice *device) > +{ > + int i; > + > + /* non-wacom devices have no LEDs */ > + if (!libwacom_get_vendor_id(device) == 0x056a) { > + for (i = 0; i < libwacom_get_num_buttons(device); i++) { > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED0)); > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED1)); > + } > + /* All I4/I5 tablets have the same (and only one) LED bank */ > + } else if (libwacom_get_class(device) == WCLASS_INTUOS4 || > + libwacom_get_class(device) == WCLASS_INTUOS5) { > + assert(libwacom_get_button_flag(device, 'A') & WACOM_BUTTON_LED0); > + assert(!(libwacom_get_button_flag(device, 'A') & WACOM_BUTTON_LED1)); > + for (i = 1; i < libwacom_get_num_buttons(device); i++) { > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED0)); > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED1)); > + } > + /* Cintiq 21UX2 has two LED banks */ > + } else if (libwacom_get_product_id(device) == 0x00cc) { > + assert(libwacom_get_button_flag(device, 'A') & WACOM_BUTTON_LED1); > + assert(libwacom_get_button_flag(device, 'J') & WACOM_BUTTON_LED0); > + for (i = 1; i < libwacom_get_num_buttons(device); i++) { > + if ('A' + i == 'J') > + continue; > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED0)); > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED1)); > + } > + /* Cintiq 24HD has two LED banks, three buttons each */ > + } else if (libwacom_get_product_id(device) == 0x00f4) { > + assert(libwacom_get_button_flag(device, 'A') & WACOM_BUTTON_LED1); > + assert(libwacom_get_button_flag(device, 'B') & WACOM_BUTTON_LED1); > + assert(libwacom_get_button_flag(device, 'C') & WACOM_BUTTON_LED1); > + assert(libwacom_get_button_flag(device, 'I') & WACOM_BUTTON_LED0); > + assert(libwacom_get_button_flag(device, 'J') & WACOM_BUTTON_LED0); > + assert(libwacom_get_button_flag(device, 'K') & WACOM_BUTTON_LED0); > + for (i = 1; i < libwacom_get_num_buttons(device); i++) { > + switch('A' + i) { > + case 'A': > + case 'B': > + case 'C': > + case 'I': > + case 'J': > + case 'K': > + break; > + default: > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED0)); > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED1)); > + break; > + } > + } > + /* all others have none */ > + } else { > + for (i = 0; i < libwacom_get_num_buttons(device); i++) { > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED0)); > + assert(!(libwacom_get_button_flag(device, 'A' + i) & WACOM_BUTTON_LED1)); > + } > + } > +} > + > static void verify_tablet(WacomDeviceDatabase *db, WacomDevice *device) > { > const char *name; > @@ -108,6 +169,8 @@ static void verify_tablet(WacomDeviceDatabase *db, WacomDevice *device) > assert(1); /* don't get here */ > } > > + verify_led_bank(device); > + > for (i = 0; i < nstyli; i++) { > const WacomStylus *stylus; > const char *stylus_name; > -- > 1.7.10.1 > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Linuxwacom-devel mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel |