NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/40287: ums doesn't support TouchPanel
>Number: 40287
>Category: kern
>Synopsis: ums doesn't support absolute axis device
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Dec 28 17:45:00 +0000 2008
>Originator: Ryo Shimizu
>Release: NetBSD 5.99.5
>Organization:
>Environment:
System: NetBSD msr 5.99.5 NetBSD 5.99.5 (KOHJINSHA) #54: Mon Dec 29 01:53:07
JST 2008 ryo%moveq.nerv.org@localhost:/usr/src/sys/arch/i386/compile/KOHJINSHA
i386
Architecture: i386
Machine: i386
>Description:
add ums support for absolute axis device.
>How-To-Repeat:
boot netbsd with DIALOGUE INC PenMount USB device.
DIALOGUE INC PenMount USB is a onboard device of KOHJINSHA SA5SX04.
# dmesg
:
uhub2 at uhub1 port 4: Standard Microsystems product 0x2503, class 9/0, rev
2.00/0.01, addr 2
uhub2: multiple transaction translators
uhub2: 2 ports with 1 removable, self powered
uhidev0 at uhub2 port 1 configuration 1 interface 0
uhidev0: DIALOGUE INC PenMount USB, rev 1.00/a4.b4, addr 3, iclass 3/1
ums0 at uhidev0
ums0: X report 0x0002 not supported
:
# usbhidctl -f 0 -v -r
Report descriptor:
Input size=6 count=1 Const page=Digitizer usage=Touch_Screen, logical range
0..63
Collection page=Generic_Desktop usage=Mouse
Collection page=0x0000 usage=0x0000
Input size=1 count=1 page=Button usage=Button_1, logical range 0..1
Input size=1 count=1 page=Button usage=Button_2, logical range 0..1
Input size=16 count=1 page=Generic_Desktop usage=X, logical range 0..1023,
physical range 0..32767
Input size=16 count=1 page=Generic_Desktop usage=Y, logical range 0..1023,
physical range 0..32767
Feature size=8 count=1 page=Generic_Desktop usage=0x00ff, logical range
0..1023, physical range 0..32767
Feature size=8 count=1 page=Generic_Desktop usage=0x00ff, logical range
0..1023, physical range 0..32767
Feature size=8 count=1 page=Generic_Desktop usage=0x00ff, logical range
0..1023, physical range 0..32767
Feature size=8 count=1 page=Generic_Desktop usage=0x00ff, logical range
0..1023, physical range 0..32767
Feature size=8 count=1 page=Generic_Desktop usage=0x00ff, logical range
0..1023, physical range 0..32767
End collection
End collection
Total input size 5 bytes
Total output size 0 bytes
Total feature size 5 bytes
>Fix:
apply this patch.
Index: ums.c
===================================================================
RCS file: /src/cvs/cvsroot/netbsd/src/sys/dev/usb/ums.c,v
retrieving revision 1.73
diff -a -c -3 -r1.73 ums.c
*** ums.c 24 May 2008 16:40:58 -0000 1.73
--- ums.c 28 Dec 2008 16:54:23 -0000
***************
*** 62,67 ****
--- 62,68 ----
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsmousevar.h>
+ #include <dev/wscons/tpcalibvar.h>
#ifdef USB_DEBUG
#define DPRINTF(x) if (umsdebug) logprintf x
***************
*** 95,106 ****
#define UMS_Z 0x01 /* z direction available */
#define UMS_SPUR_BUT_UP 0x02 /* spurious button up events */
#define UMS_REVZ 0x04 /* Z-axis is reversed */
int nbuttons;
u_int32_t sc_buttons; /* mouse button status */
device_t sc_wsmousedev;
!
char sc_dying;
};
--- 96,111 ----
#define UMS_Z 0x01 /* z direction available */
#define UMS_SPUR_BUT_UP 0x02 /* spurious button up events */
#define UMS_REVZ 0x04 /* Z-axis is reversed */
+ #define UMS_TPANEL 0x08 /* absolute XY-axis */
int nbuttons;
u_int32_t sc_buttons; /* mouse button status */
+ int sc_x; /* last X (UMS_TPANEL) */
+ int sc_y; /* last Y (UMS_TPANEL) */
device_t sc_wsmousedev;
! struct tpcalib_softc sc_tpcalib;
! struct wsmouse_calibcoords sc_calibcoords;
char sc_dying;
};
***************
*** 162,167 ****
--- 167,175 ----
sc->sc_hdev.sc_parent = uha->parent;
sc->sc_hdev.sc_report_id = uha->reportid;
+ memset(&sc->sc_calibcoords, 0, sizeof(sc->sc_calibcoords));
+ sc->sc_calibcoords.samplelen = WSMOUSE_CALIBCOORDS_RESET;
+
quirks = usbd_get_quirks(uha->parent->sc_udev)->uq_flags;
if (quirks & UQ_MS_REVZ)
sc->flags |= UMS_REVZ;
***************
*** 179,189 ****
USBDEVNAME(sc->sc_hdev.sc_dev));
USB_ATTACH_ERROR_RETURN;
}
! if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
! aprint_error("\n%s: X report 0x%04x not supported\n",
! USBDEVNAME(sc->sc_hdev.sc_dev), flags);
! USB_ATTACH_ERROR_RETURN;
! }
if (!hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y),
uha->reportid, hid_input, &sc->sc_loc_y, &flags)) {
--- 187,194 ----
USBDEVNAME(sc->sc_hdev.sc_dev));
USB_ATTACH_ERROR_RETURN;
}
! if ((flags & MOUSE_FLAGS_MASK) == 0)
! sc->flags |= UMS_TPANEL;
if (!hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y),
uha->reportid, hid_input, &sc->sc_loc_y, &flags)) {
***************
*** 191,201 ****
USBDEVNAME(sc->sc_hdev.sc_dev));
USB_ATTACH_ERROR_RETURN;
}
! if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
! aprint_error("\n%s: Y report 0x%04x not supported\n",
! USBDEVNAME(sc->sc_hdev.sc_dev), flags);
! USB_ATTACH_ERROR_RETURN;
! }
/* Try the wheel first as the Z activator since it's tradition. */
wheel = hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP,
--- 196,203 ----
USBDEVNAME(sc->sc_hdev.sc_dev));
USB_ATTACH_ERROR_RETURN;
}
! if ((flags & MOUSE_FLAGS_MASK) == 0)
! sc->flags |= UMS_TPANEL;
/* Try the wheel first as the Z activator since it's tradition. */
wheel = hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP,
***************
*** 246,254 ****
break;
sc->nbuttons = i - 1;
! aprint_normal(": %d button%s%s\n",
sc->nbuttons, sc->nbuttons == 1 ? "" : "s",
! sc->flags & UMS_Z ? " and Z dir." : "");
for (i = 1; i <= sc->nbuttons; i++)
hid_locate(desc, size, HID_USAGE2(HUP_BUTTON, i),
--- 248,257 ----
break;
sc->nbuttons = i - 1;
! aprint_normal(": %d button%s%s%s\n",
sc->nbuttons, sc->nbuttons == 1 ? "" : "s",
! sc->flags & UMS_Z ? ", Z dir" : "",
! sc->flags & UMS_TPANEL ? ", touchpanel" : "");
for (i = 1; i <= sc->nbuttons; i++)
hid_locate(desc, size, HID_USAGE2(HUP_BUTTON, i),
***************
*** 275,280 ****
--- 278,287 ----
sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
+ tpcalib_init(&sc->sc_tpcalib);
+ tpcalib_ioctl(&sc->sc_tpcalib, WSMOUSEIO_SCALIBCOORDS,
+ (void *)&sc->sc_calibcoords, 0, 0);
+
USB_ATTACH_SUCCESS_RETURN;
}
***************
*** 334,361 ****
DPRINTFN(5,("ums_intr: len=%d\n", len));
! dx = hid_get_data(ibuf, &sc->sc_loc_x);
! dy = -hid_get_data(ibuf, &sc->sc_loc_y);
! dz = hid_get_data(ibuf, &sc->sc_loc_z);
! dw = hid_get_data(ibuf, &sc->sc_loc_w);
if (sc->flags & UMS_REVZ)
dz = -dz;
for (i = 0; i < sc->nbuttons; i++)
if (hid_get_data(ibuf, &sc->sc_loc_btn[i]))
buttons |= (1 << UMS_BUT(i));
! if (dx != 0 || dy != 0 || dz != 0 || dw != 0 ||
! buttons != sc->sc_buttons) {
! DPRINTFN(10, ("ums_intr: x:%d y:%d z:%d w:%d buttons:0x%x\n",
! dx, dy, dz, dw, buttons));
! sc->sc_buttons = buttons;
! if (sc->sc_wsmousedev != NULL) {
! s = spltty();
! wsmouse_input(sc->sc_wsmousedev,
! buttons,
! dx, dy, dz, dw,
! WSMOUSE_INPUT_DELTA);
! splx(s);
}
}
}
--- 341,394 ----
DPRINTFN(5,("ums_intr: len=%d\n", len));
! dx = hid_get_data(ibuf, &sc->sc_loc_x);
! dy = hid_get_data(ibuf, &sc->sc_loc_y);
! dz = hid_get_data(ibuf, &sc->sc_loc_z);
! dw = hid_get_data(ibuf, &sc->sc_loc_w);
if (sc->flags & UMS_REVZ)
dz = -dz;
for (i = 0; i < sc->nbuttons; i++)
if (hid_get_data(ibuf, &sc->sc_loc_btn[i]))
buttons |= (1 << UMS_BUT(i));
! if (sc->flags & UMS_TPANEL) {
! tpcalib_trans(&sc->sc_tpcalib, dx, dy, &dx, &dy);
! if (dx != sc->sc_x || dy != sc->sc_y || dz != 0 || dw != 0 ||
! buttons != sc->sc_buttons) {
!
! DPRINTFN(10, ("ums_intr: absx:%d absy:%d, z:%d w:%d
buttons:0x%x\n",
! dx, dy, dz, dw, buttons));
!
! sc->sc_x = dx;
! sc->sc_y = dy;
! sc->sc_buttons = buttons;
! if (sc->sc_wsmousedev != NULL) {
! s = spltty();
! wsmouse_input(sc->sc_wsmousedev,
! buttons,
! dx, dy, dz, dw,
! WSMOUSE_INPUT_ABSOLUTE_X |
! WSMOUSE_INPUT_ABSOLUTE_Y);
! splx(s);
! }
! }
! } else {
! dy = -dy;
! if (dx != 0 || dy != 0 || dz != 0 || dw != 0 ||
! buttons != sc->sc_buttons) {
!
! DPRINTFN(10, ("ums_intr: x:%d y:%d z:%d w:%d
buttons:0x%x\n",
! dx, dy, dz, dw, buttons));
!
! sc->sc_buttons = buttons;
! if (sc->sc_wsmousedev != NULL) {
! s = spltty();
! wsmouse_input(sc->sc_wsmousedev,
! buttons,
! dx, dy, dz, dw,
! WSMOUSE_INPUT_DELTA);
! splx(s);
! }
}
}
}
***************
*** 401,410 ****
struct lwp * p)
{
switch (cmd) {
case WSMOUSEIO_GTYPE:
! *(u_int *)data = WSMOUSE_TYPE_USB;
return (0);
}
return (EPASSTHROUGH);
--- 434,452 ----
struct lwp * p)
{
+ struct ums_softc *sc = (struct ums_softc *)v;
+
switch (cmd) {
case WSMOUSEIO_GTYPE:
! if (sc->flags & UMS_TPANEL)
! *(u_int *)data = WSMOUSE_TYPE_TPANEL;
! else
! *(u_int *)data = WSMOUSE_TYPE_USB;
return (0);
+
+ case WSMOUSEIO_SCALIBCOORDS:
+ case WSMOUSEIO_GCALIBCOORDS:
+ return tpcalib_ioctl(&sc->sc_tpcalib, cmd, data, flag, p);
}
return (EPASSTHROUGH);
Home |
Main Index |
Thread Index |
Old Index