Ticket #3744: wacom_c_v1.patch
File wacom_c_v1.patch, 3.1 KB (added by , 15 years ago) |
---|
-
src/add-ons/kernel/drivers/input/wacom/wacom.c
113 113 const usb_configuration_info *conf; 114 114 bool setConfiguration = false; 115 115 116 // we need these twofor a Wacom tablet116 // we need these four for a Wacom tablet 117 117 size_t controlTransferLength; 118 int i; 118 119 char repData[2] = { 0x02, 0x02 }; 120 char retData[2] = { 0x00, 0x00 }; 119 121 120 122 conf = usb->get_configuration(dev); 121 123 DPRINTF_INFO((ID "add_device(%ld, %p)\n", dev, conf)); … … 202 204 // let's hope Wacom doesn't produce normal mice any time soon, or this 203 205 // check will have to be more specific about product_id...hehe 204 206 if (udd->vendor_id == 0x056a) { 205 // do the control transfers to set up absolute mode (default is HID mode) 207 // do the control transfers to set up absolute mode (default is HID 208 // mode) 209 210 // see 'Device Class Definition for HID 1.11' (HID1_11.pdf), 211 // par. 7.2 (available at www.usb.org/developers/hidpage) 212 213 // set protocol mode to 'report' (instead of 'boot') 206 214 controlTransferLength = 0; 215 // HID Class-Specific Request, Host to device (=0x21): 216 // SET_PROTOCOL (=0x0b) to Report Protocol (=1) 217 // of Interface #0 (=0) 207 218 st = usb->send_request(dev, 0x21, 0x0b, 1, 0, 0, 0, 208 219 &controlTransferLength); 209 220 210 221 if (st < B_OK) { 211 222 dprintf(ID "add_device() - control transfer 1 failed: %ld\n", 212 223 st); 213 224 } 214 215 // "set interface" -> ?!? 225 226 // try five times to set the tablet to 'Wacom'-mode (enabling 227 // absolute mode, pressure data, etc.) 216 228 controlTransferLength = 2; 217 st = usb->send_request(dev, 0x21, 0x09, (3 << 8) + 2, 1, 2, repData, 218 &controlTransferLength); 229 230 for (i = 0; i < 5; i++) { 231 // HID Class-Specific Request, Host to device (=0x21): 232 // SET_REPORT (=0x09) type Feature (=3) with ID 2 (=2) of 233 // Interface #1 (=1) to repData (== { 0x02, 0x02 }) 234 st = usb->send_request(dev, 0x21, 0x09, (3 << 8) + 2, 1, 2, 235 repData, &controlTransferLength); 219 236 220 if (st < B_OK) { 221 dprintf(ID "add_device() - control transfer 2 failed: %ld\n", 222 st); 237 if (st < B_OK) { 238 dprintf(ID "add_device() - control transfer 2 failed: %ld\ 239 \n", st); 240 } 241 242 // check if registers are set correctly 243 244 dprintf(ID "retData: %u - %u\n", retData[0], retData[1]); 245 246 // HID Class-Specific Request, Device to host (=0xA1): 247 // GET_REPORT (=0x01) type Feature (=3) with ID 2 (=2) of 248 // Interface #1 (=1) to retData 249 st = usb->send_request(dev, 0xA1, 0x01, (3 << 8) + 2, 1, 2, 250 retData, &controlTransferLength); 251 252 if (st < B_OK) { 253 dprintf(ID "add_device() - control transfer 3 failed: %ld\ 254 \n", st); 255 } 256 257 dprintf(ID "retData: %u - %u\n", retData[0], retData[1]); 258 dprintf("====================================\n"); 259 260 if (retData[0] == repData[0] && retData[1] == repData[1]) break; 261 223 262 } 263 264 dprintf(ID "count: %u\n", i); 265 266 if (i > 4) { 267 dprintf(ID "add_device() - set 'Wacom'-mode failed\n"); 268 } 224 269 } 225 270 // } 226 271