Patch by idefix: Code cleanup and debug output cleanup. Part of patch to
ticket #3744, thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36842 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -115,7 +115,7 @@ add_device(usb_device dev)
|
|||||||
|
|
||||||
// we need these four for a Wacom tablet
|
// we need these four for a Wacom tablet
|
||||||
size_t controlTransferLength;
|
size_t controlTransferLength;
|
||||||
int i;
|
int tryCount;
|
||||||
char repData[2] = { 0x02, 0x02 };
|
char repData[2] = { 0x02, 0x02 };
|
||||||
char retData[2] = { 0x00, 0x00 };
|
char retData[2] = { 0x00, 0x00 };
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ got_one:
|
|||||||
// absolute mode, pressure data, etc.)
|
// absolute mode, pressure data, etc.)
|
||||||
controlTransferLength = 2;
|
controlTransferLength = 2;
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
for (tryCount = 0; tryCount < 5; tryCount++) {
|
||||||
// HID Class-Specific Request, Host to device (=0x21):
|
// HID Class-Specific Request, Host to device (=0x21):
|
||||||
// SET_REPORT (=0x09) type Feature (=3) with ID 2 (=2) of
|
// SET_REPORT (=0x09) type Feature (=3) with ID 2 (=2) of
|
||||||
// Interface #0 (=0) to repData (== { 0x02, 0x02 })
|
// Interface #0 (=0) to repData (== { 0x02, 0x02 })
|
||||||
@@ -235,8 +235,8 @@ got_one:
|
|||||||
repData, &controlTransferLength);
|
repData, &controlTransferLength);
|
||||||
|
|
||||||
if (st < B_OK) {
|
if (st < B_OK) {
|
||||||
dprintf(ID "add_device() - control transfer 2 failed: %ld\
|
dprintf(ID "add_device() - control transfer 2 failed: %ld"
|
||||||
\n", st);
|
"\n", st);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if registers are set correctly
|
// check if registers are set correctly
|
||||||
@@ -248,20 +248,24 @@ got_one:
|
|||||||
retData, &controlTransferLength);
|
retData, &controlTransferLength);
|
||||||
|
|
||||||
if (st < B_OK) {
|
if (st < B_OK) {
|
||||||
dprintf(ID "add_device() - control transfer 3 failed: %ld\
|
dprintf(ID "add_device() - control transfer 3 failed: %ld"
|
||||||
\n", st);
|
"\n", st);
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf(ID "retData: %u - %u\n", retData[0], retData[1]);
|
DPRINTF_INFO((ID "add_device() - retData: %u - %u\n",
|
||||||
dprintf("====================================\n");
|
retData[0], retData[1]));
|
||||||
|
|
||||||
if (retData[0] == repData[0] && retData[1] == repData[1]) break;
|
|
||||||
|
|
||||||
|
if (retData[0] == repData[0] && retData[1] == repData[1]) {
|
||||||
|
DPRINTF_INFO((ID "add_device() - successfully set "
|
||||||
|
"'Wacom'-mode\n"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf(ID "count: %u\n", i);
|
DPRINTF_INFO((ID "add_device() - number of tries: %u\n",
|
||||||
|
tryCount + 1));
|
||||||
|
|
||||||
if (i > 4) {
|
if (tryCount > 4) {
|
||||||
dprintf(ID "add_device() - set 'Wacom'-mode failed\n");
|
dprintf(ID "add_device() - set 'Wacom'-mode failed\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user