diff 86e3e0791c239bbaaece242cf78fa56794b58a72 uncommitted --- a/sys/src/cmd/nusb/kb/hid.h +++ b/sys/src/cmd/nusb/kb/hid.h @@ -77,4 +77,5 @@ Flinear = 0<<4, Fnonlin = 1<<4, Fpref = 0<<5, Fnopref = 1<<5, Fnonull = 0<<6, Fnullst = 1<<6, + Fbitf = 0<<8, Fbbyt = 1<<8, }; --- a/sys/src/cmd/nusb/kb/kb.c +++ b/sys/src/cmd/nusb/kb/kb.c @@ -241,6 +241,19 @@ return v; } +static int +getbytesbe(uchar *p, uchar *e, int bytes) +{ + int v; + + v = 0; + if(p < e){ + while(bytes--) + v |= *p++<p, p->e, g[RepSize], p->o); + if((f & (Fbitf|Fbbyt)) == Fbbyt){ + if(p->o%8 != 0 || g[RepSize]%8 != 0){ + p->o += g[RepSize]; + return; + } + v = getbytesbe(p->p + p->o/8, p->e, g[RepSize]/8); + }else{ + v = getbits(p->p, p->e, g[RepSize], p->o); + } p->o += g[RepSize]; if((f & (Fconst|Fdata)) != Fdata) @@ -928,6 +949,51 @@ } static void +wacomcth690(Hiddev *f) +{ + static uchar descr[] = { + 0x05, 0x0D, /* Usage Page (Digitizer), */ + 0x09, 0x01, /* Usage (Digitizer), */ + 0xA1, 0x01, /* Collection (Application), */ + 0x85, 0x10, /* Report ID (16), */ + 0x09, 0x20, /* Usage (Stylus), */ + 0xA0, /* Collection (Physical), */ + 0x75, 0x07, /* Report Size (7), */ + 0x95, 0x01, /* Report Count (1), */ + 0x81, 0x03, /* Input (Constant, Variable), */ + 0x14, /* Logical Minimum (0), */ + 0x25, 0x01, /* Logical Maximum (1), */ + 0x09, 0x32, /* Usage (In Range), */ + 0x75, 0x01, /* Report Size (1), */ + 0x95, 0x01, /* Report Count (1), */ + 0x81, 0x02, /* Input (Variable), */ + 0xA4, /* Push, */ + 0x05, 0x01, /* Usage Page (Desktop), */ + 0x65, 0x13, /* Unit (Inch), */ + 0x55, 0xFD, /* Unit Exponent (-3), */ + 0x75, 0x10, /* Report Size (16), */ + 0x34, /* Physical Minimum (0), */ + 0x09, 0x30, /* Usage (X), */ + 0x26, 0x30, 0x2A, /* Logical Maximum, */ + 0x82, 0x02, 0x01, /* Input (Variable, Buffered Bytes), */ + 0x09, 0x31, /* Usage (Y), */ + 0x26, 0x5E, 0x1A, /* Logical Maximum, */ + 0x82, 0x02, 0x01, /* Input (Variable, Buffered Bytes), */ + 0xB4, /* Pop, */ + 0x09, 0x42, /* Usage (Tip Switch), */ + 0x75, 0x10, /* Report Size (16), */ + 0x95, 0x01, /* Report Count (1), */ + 0x27, 0xC0, 0xFF, 0x00, 0x00, /* Logical Maximum, */ + 0x81, 0x02, /* Input (Variable), */ + 0xC0, /* End Collection, */ + 0xC0 /* End Collection */ + }; + + /* override report descriptor */ + memmove(f->rep, descr, f->nrep = sizeof(descr)); +} + +static void quirks(Hiddev *f) { Dev *d; @@ -956,6 +1022,11 @@ f->rep[13] = 8; f->rep[21] = 8; f->rep[31] = 0; + return; + } + + if(d->usb->vid == 0x056a && d->usb->did == 0x033e){ + wacomcth690(f); return; } }