Patch by idefix:
* Use the correct interface index for the control transfer that sets a Wacom tablet into tablet mode. * Check if the mode is indeed setup correctly. * Retry switching the mode up to five times, as done in the Linux driver. Thanks a bunch! As Michael has proposed in ticket #3744, the whole Wacom driver should be merged into the existing HID driver framework (eventually). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33301 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -113,9 +113,11 @@ add_device(usb_device dev)
|
|||||||
const usb_configuration_info *conf;
|
const usb_configuration_info *conf;
|
||||||
bool setConfiguration = false;
|
bool setConfiguration = false;
|
||||||
|
|
||||||
// we need these two for a Wacom tablet
|
// we need these four for a Wacom tablet
|
||||||
size_t controlTransferLength;
|
size_t controlTransferLength;
|
||||||
|
int i;
|
||||||
char repData[2] = { 0x02, 0x02 };
|
char repData[2] = { 0x02, 0x02 };
|
||||||
|
char retData[2] = { 0x00, 0x00 };
|
||||||
|
|
||||||
conf = usb->get_configuration(dev);
|
conf = usb->get_configuration(dev);
|
||||||
DPRINTF_INFO((ID "add_device(%ld, %p)\n", dev, conf));
|
DPRINTF_INFO((ID "add_device(%ld, %p)\n", dev, conf));
|
||||||
@@ -202,24 +204,65 @@ got_one:
|
|||||||
// let's hope Wacom doesn't produce normal mice any time soon, or this
|
// let's hope Wacom doesn't produce normal mice any time soon, or this
|
||||||
// check will have to be more specific about product_id...hehe
|
// check will have to be more specific about product_id...hehe
|
||||||
if (udd->vendor_id == 0x056a) {
|
if (udd->vendor_id == 0x056a) {
|
||||||
// do the control transfers to set up absolute mode (default is HID mode)
|
// do the control transfers to set up absolute mode (default is HID
|
||||||
|
// mode)
|
||||||
|
|
||||||
|
// see 'Device Class Definition for HID 1.11' (HID1_11.pdf),
|
||||||
|
// par. 7.2 (available at www.usb.org/developers/hidpage)
|
||||||
|
|
||||||
|
// set protocol mode to 'report' (instead of 'boot')
|
||||||
controlTransferLength = 0;
|
controlTransferLength = 0;
|
||||||
|
// HID Class-Specific Request, Host to device (=0x21):
|
||||||
|
// SET_PROTOCOL (=0x0b) to Report Protocol (=1)
|
||||||
|
// of Interface #0 (=0)
|
||||||
st = usb->send_request(dev, 0x21, 0x0b, 1, 0, 0, 0,
|
st = usb->send_request(dev, 0x21, 0x0b, 1, 0, 0, 0,
|
||||||
&controlTransferLength);
|
&controlTransferLength);
|
||||||
|
|
||||||
if (st < B_OK) {
|
if (st < B_OK) {
|
||||||
dprintf(ID "add_device() - control transfer 1 failed: %ld\n",
|
dprintf(ID "add_device() - control transfer 1 failed: %ld\n",
|
||||||
st);
|
st);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "set interface" -> ?!?
|
// try up to five times to set the tablet to 'Wacom'-mode (enabling
|
||||||
|
// absolute mode, pressure data, etc.)
|
||||||
controlTransferLength = 2;
|
controlTransferLength = 2;
|
||||||
st = usb->send_request(dev, 0x21, 0x09, (3 << 8) + 2, 1, 2, repData,
|
|
||||||
&controlTransferLength);
|
for (i = 0; i < 5; i++) {
|
||||||
|
// HID Class-Specific Request, Host to device (=0x21):
|
||||||
|
// SET_REPORT (=0x09) type Feature (=3) with ID 2 (=2) of
|
||||||
|
// Interface #0 (=0) to repData (== { 0x02, 0x02 })
|
||||||
|
st = usb->send_request(dev, 0x21, 0x09, (3 << 8) + 2, 0, 2,
|
||||||
|
repData, &controlTransferLength);
|
||||||
|
|
||||||
if (st < B_OK) {
|
if (st < B_OK) {
|
||||||
dprintf(ID "add_device() - control transfer 2 failed: %ld\n",
|
dprintf(ID "add_device() - control transfer 2 failed: %ld\
|
||||||
st);
|
\n", st);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if registers are set correctly
|
||||||
|
|
||||||
|
// HID Class-Specific Request, Device to host (=0xA1):
|
||||||
|
// GET_REPORT (=0x01) type Feature (=3) with ID 2 (=2) of
|
||||||
|
// Interface #0 (=0) to retData
|
||||||
|
st = usb->send_request(dev, 0xA1, 0x01, (3 << 8) + 2, 0, 2,
|
||||||
|
retData, &controlTransferLength);
|
||||||
|
|
||||||
|
if (st < B_OK) {
|
||||||
|
dprintf(ID "add_device() - control transfer 3 failed: %ld\
|
||||||
|
\n", st);
|
||||||
|
}
|
||||||
|
|
||||||
|
dprintf(ID "retData: %u - %u\n", retData[0], retData[1]);
|
||||||
|
dprintf("====================================\n");
|
||||||
|
|
||||||
|
if (retData[0] == repData[0] && retData[1] == repData[1]) break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dprintf(ID "count: %u\n", i);
|
||||||
|
|
||||||
|
if (i > 4) {
|
||||||
|
dprintf(ID "add_device() - set 'Wacom'-mode failed\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user