core.c revision 159d865f2078ffa4441abb0155f725368371f836
1/* 2 HIDP implementation for Linux Bluetooth stack (BlueZ). 3 Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> 4 Copyright (C) 2013 David Herrmann <dh.herrmann@gmail.com> 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License version 2 as 8 published by the Free Software Foundation; 9 10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 21 SOFTWARE IS DISCLAIMED. 22*/ 23 24#include <linux/kref.h> 25#include <linux/module.h> 26#include <linux/file.h> 27#include <linux/kthread.h> 28#include <linux/hidraw.h> 29 30#include <net/bluetooth/bluetooth.h> 31#include <net/bluetooth/hci_core.h> 32#include <net/bluetooth/l2cap.h> 33 34#include "hidp.h" 35 36#define VERSION "1.2" 37 38static DECLARE_RWSEM(hidp_session_sem); 39static LIST_HEAD(hidp_session_list); 40 41static unsigned char hidp_keycode[256] = { 42 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 43 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 44 21, 44, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 45 14, 15, 57, 12, 13, 26, 27, 43, 43, 39, 40, 41, 51, 52, 46 53, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 87, 88, 47 99, 70, 119, 110, 102, 104, 111, 107, 109, 106, 105, 108, 103, 69, 48 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71, 72, 73, 49 82, 83, 86, 127, 116, 117, 183, 184, 185, 186, 187, 188, 189, 190, 50 191, 192, 193, 194, 134, 138, 130, 132, 128, 129, 131, 137, 133, 135, 51 136, 113, 115, 114, 0, 0, 0, 121, 0, 89, 93, 124, 92, 94, 52 95, 0, 0, 0, 122, 123, 90, 91, 85, 0, 0, 0, 0, 0, 53 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58 29, 42, 56, 125, 97, 54, 100, 126, 164, 166, 165, 163, 161, 115, 59 114, 113, 150, 158, 159, 128, 136, 177, 178, 176, 142, 152, 173, 140 60}; 61 62static unsigned char hidp_mkeyspat[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; 63 64static int hidp_session_probe(struct l2cap_conn *conn, 65 struct l2cap_user *user); 66static void hidp_session_remove(struct l2cap_conn *conn, 67 struct l2cap_user *user); 68static int hidp_session_thread(void *arg); 69static void hidp_session_terminate(struct hidp_session *s); 70 71static void hidp_copy_session(struct hidp_session *session, struct hidp_conninfo *ci) 72{ 73 memset(ci, 0, sizeof(*ci)); 74 bacpy(&ci->bdaddr, &session->bdaddr); 75 76 ci->flags = session->flags; 77 ci->state = BT_CONNECTED; 78 79 if (session->input) { 80 ci->vendor = session->input->id.vendor; 81 ci->product = session->input->id.product; 82 ci->version = session->input->id.version; 83 if (session->input->name) 84 strlcpy(ci->name, session->input->name, 128); 85 else 86 strlcpy(ci->name, "HID Boot Device", 128); 87 } else if (session->hid) { 88 ci->vendor = session->hid->vendor; 89 ci->product = session->hid->product; 90 ci->version = session->hid->version; 91 strlcpy(ci->name, session->hid->name, 128); 92 } 93} 94 95/* assemble skb, queue message on @transmit and wake up the session thread */ 96static int hidp_send_message(struct hidp_session *session, struct socket *sock, 97 struct sk_buff_head *transmit, unsigned char hdr, 98 const unsigned char *data, int size) 99{ 100 struct sk_buff *skb; 101 struct sock *sk = sock->sk; 102 103 BT_DBG("session %p data %p size %d", session, data, size); 104 105 if (atomic_read(&session->terminate)) 106 return -EIO; 107 108 skb = alloc_skb(size + 1, GFP_ATOMIC); 109 if (!skb) { 110 BT_ERR("Can't allocate memory for new frame"); 111 return -ENOMEM; 112 } 113 114 *skb_put(skb, 1) = hdr; 115 if (data && size > 0) 116 memcpy(skb_put(skb, size), data, size); 117 118 skb_queue_tail(transmit, skb); 119 wake_up_interruptible(sk_sleep(sk)); 120 121 return 0; 122} 123 124static int hidp_send_ctrl_message(struct hidp_session *session, 125 unsigned char hdr, const unsigned char *data, 126 int size) 127{ 128 return hidp_send_message(session, session->ctrl_sock, 129 &session->ctrl_transmit, hdr, data, size); 130} 131 132static int hidp_send_intr_message(struct hidp_session *session, 133 unsigned char hdr, const unsigned char *data, 134 int size) 135{ 136 return hidp_send_message(session, session->intr_sock, 137 &session->intr_transmit, hdr, data, size); 138} 139 140static int hidp_input_event(struct input_dev *dev, unsigned int type, 141 unsigned int code, int value) 142{ 143 struct hidp_session *session = input_get_drvdata(dev); 144 unsigned char newleds; 145 unsigned char hdr, data[2]; 146 147 BT_DBG("session %p type %d code %d value %d", 148 session, type, code, value); 149 150 if (type != EV_LED) 151 return -1; 152 153 newleds = (!!test_bit(LED_KANA, dev->led) << 3) | 154 (!!test_bit(LED_COMPOSE, dev->led) << 3) | 155 (!!test_bit(LED_SCROLLL, dev->led) << 2) | 156 (!!test_bit(LED_CAPSL, dev->led) << 1) | 157 (!!test_bit(LED_NUML, dev->led)); 158 159 if (session->leds == newleds) 160 return 0; 161 162 session->leds = newleds; 163 164 hdr = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT; 165 data[0] = 0x01; 166 data[1] = newleds; 167 168 return hidp_send_intr_message(session, hdr, data, 2); 169} 170 171static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb) 172{ 173 struct input_dev *dev = session->input; 174 unsigned char *keys = session->keys; 175 unsigned char *udata = skb->data + 1; 176 signed char *sdata = skb->data + 1; 177 int i, size = skb->len - 1; 178 179 switch (skb->data[0]) { 180 case 0x01: /* Keyboard report */ 181 for (i = 0; i < 8; i++) 182 input_report_key(dev, hidp_keycode[i + 224], (udata[0] >> i) & 1); 183 184 /* If all the key codes have been set to 0x01, it means 185 * too many keys were pressed at the same time. */ 186 if (!memcmp(udata + 2, hidp_mkeyspat, 6)) 187 break; 188 189 for (i = 2; i < 8; i++) { 190 if (keys[i] > 3 && memscan(udata + 2, keys[i], 6) == udata + 8) { 191 if (hidp_keycode[keys[i]]) 192 input_report_key(dev, hidp_keycode[keys[i]], 0); 193 else 194 BT_ERR("Unknown key (scancode %#x) released.", keys[i]); 195 } 196 197 if (udata[i] > 3 && memscan(keys + 2, udata[i], 6) == keys + 8) { 198 if (hidp_keycode[udata[i]]) 199 input_report_key(dev, hidp_keycode[udata[i]], 1); 200 else 201 BT_ERR("Unknown key (scancode %#x) pressed.", udata[i]); 202 } 203 } 204 205 memcpy(keys, udata, 8); 206 break; 207 208 case 0x02: /* Mouse report */ 209 input_report_key(dev, BTN_LEFT, sdata[0] & 0x01); 210 input_report_key(dev, BTN_RIGHT, sdata[0] & 0x02); 211 input_report_key(dev, BTN_MIDDLE, sdata[0] & 0x04); 212 input_report_key(dev, BTN_SIDE, sdata[0] & 0x08); 213 input_report_key(dev, BTN_EXTRA, sdata[0] & 0x10); 214 215 input_report_rel(dev, REL_X, sdata[1]); 216 input_report_rel(dev, REL_Y, sdata[2]); 217 218 if (size > 3) 219 input_report_rel(dev, REL_WHEEL, sdata[3]); 220 break; 221 } 222 223 input_sync(dev); 224} 225 226static int hidp_send_report(struct hidp_session *session, struct hid_report *report) 227{ 228 unsigned char buf[32], hdr; 229 int rsize; 230 231 rsize = ((report->size - 1) >> 3) + 1 + (report->id > 0); 232 if (rsize > sizeof(buf)) 233 return -EIO; 234 235 hid_output_report(report, buf); 236 hdr = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT; 237 238 return hidp_send_intr_message(session, hdr, buf, rsize); 239} 240 241static int hidp_hidinput_event(struct input_dev *dev, unsigned int type, 242 unsigned int code, int value) 243{ 244 struct hid_device *hid = input_get_drvdata(dev); 245 struct hidp_session *session = hid->driver_data; 246 struct hid_field *field; 247 int offset; 248 249 BT_DBG("session %p type %d code %d value %d", 250 session, type, code, value); 251 252 if (type != EV_LED) 253 return -1; 254 255 offset = hidinput_find_field(hid, type, code, &field); 256 if (offset == -1) { 257 hid_warn(dev, "event field not found\n"); 258 return -1; 259 } 260 261 hid_set_field(field, offset, value); 262 263 return hidp_send_report(session, field->report); 264} 265 266static int hidp_get_raw_report(struct hid_device *hid, 267 unsigned char report_number, 268 unsigned char *data, size_t count, 269 unsigned char report_type) 270{ 271 struct hidp_session *session = hid->driver_data; 272 struct sk_buff *skb; 273 size_t len; 274 int numbered_reports = hid->report_enum[report_type].numbered; 275 int ret; 276 277 if (atomic_read(&session->terminate)) 278 return -EIO; 279 280 switch (report_type) { 281 case HID_FEATURE_REPORT: 282 report_type = HIDP_TRANS_GET_REPORT | HIDP_DATA_RTYPE_FEATURE; 283 break; 284 case HID_INPUT_REPORT: 285 report_type = HIDP_TRANS_GET_REPORT | HIDP_DATA_RTYPE_INPUT; 286 break; 287 case HID_OUTPUT_REPORT: 288 report_type = HIDP_TRANS_GET_REPORT | HIDP_DATA_RTYPE_OUPUT; 289 break; 290 default: 291 return -EINVAL; 292 } 293 294 if (mutex_lock_interruptible(&session->report_mutex)) 295 return -ERESTARTSYS; 296 297 /* Set up our wait, and send the report request to the device. */ 298 session->waiting_report_type = report_type & HIDP_DATA_RTYPE_MASK; 299 session->waiting_report_number = numbered_reports ? report_number : -1; 300 set_bit(HIDP_WAITING_FOR_RETURN, &session->flags); 301 data[0] = report_number; 302 ret = hidp_send_ctrl_message(session, report_type, data, 1); 303 if (ret) 304 goto err; 305 306 /* Wait for the return of the report. The returned report 307 gets put in session->report_return. */ 308 while (test_bit(HIDP_WAITING_FOR_RETURN, &session->flags) && 309 !atomic_read(&session->terminate)) { 310 int res; 311 312 res = wait_event_interruptible_timeout(session->report_queue, 313 !test_bit(HIDP_WAITING_FOR_RETURN, &session->flags) 314 || atomic_read(&session->terminate), 315 5*HZ); 316 if (res == 0) { 317 /* timeout */ 318 ret = -EIO; 319 goto err; 320 } 321 if (res < 0) { 322 /* signal */ 323 ret = -ERESTARTSYS; 324 goto err; 325 } 326 } 327 328 skb = session->report_return; 329 if (skb) { 330 len = skb->len < count ? skb->len : count; 331 memcpy(data, skb->data, len); 332 333 kfree_skb(skb); 334 session->report_return = NULL; 335 } else { 336 /* Device returned a HANDSHAKE, indicating protocol error. */ 337 len = -EIO; 338 } 339 340 clear_bit(HIDP_WAITING_FOR_RETURN, &session->flags); 341 mutex_unlock(&session->report_mutex); 342 343 return len; 344 345err: 346 clear_bit(HIDP_WAITING_FOR_RETURN, &session->flags); 347 mutex_unlock(&session->report_mutex); 348 return ret; 349} 350 351static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count, 352 unsigned char report_type) 353{ 354 struct hidp_session *session = hid->driver_data; 355 int ret; 356 357 if (report_type == HID_OUTPUT_REPORT) { 358 report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT; 359 return hidp_send_intr_message(session, report_type, 360 data, count); 361 } else if (report_type != HID_FEATURE_REPORT) { 362 return -EINVAL; 363 } 364 365 if (mutex_lock_interruptible(&session->report_mutex)) 366 return -ERESTARTSYS; 367 368 /* Set up our wait, and send the report request to the device. */ 369 set_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags); 370 report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE; 371 ret = hidp_send_ctrl_message(session, report_type, data, count); 372 if (ret) 373 goto err; 374 375 /* Wait for the ACK from the device. */ 376 while (test_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags) && 377 !atomic_read(&session->terminate)) { 378 int res; 379 380 res = wait_event_interruptible_timeout(session->report_queue, 381 !test_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags) 382 || atomic_read(&session->terminate), 383 10*HZ); 384 if (res == 0) { 385 /* timeout */ 386 ret = -EIO; 387 goto err; 388 } 389 if (res < 0) { 390 /* signal */ 391 ret = -ERESTARTSYS; 392 goto err; 393 } 394 } 395 396 if (!session->output_report_success) { 397 ret = -EIO; 398 goto err; 399 } 400 401 ret = count; 402 403err: 404 clear_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags); 405 mutex_unlock(&session->report_mutex); 406 return ret; 407} 408 409static void hidp_idle_timeout(unsigned long arg) 410{ 411 struct hidp_session *session = (struct hidp_session *) arg; 412 413 hidp_session_terminate(session); 414} 415 416static void hidp_set_timer(struct hidp_session *session) 417{ 418 if (session->idle_to > 0) 419 mod_timer(&session->timer, jiffies + HZ * session->idle_to); 420} 421 422static void hidp_del_timer(struct hidp_session *session) 423{ 424 if (session->idle_to > 0) 425 del_timer(&session->timer); 426} 427 428static void hidp_process_handshake(struct hidp_session *session, 429 unsigned char param) 430{ 431 BT_DBG("session %p param 0x%02x", session, param); 432 session->output_report_success = 0; /* default condition */ 433 434 switch (param) { 435 case HIDP_HSHK_SUCCESSFUL: 436 /* FIXME: Call into SET_ GET_ handlers here */ 437 session->output_report_success = 1; 438 break; 439 440 case HIDP_HSHK_NOT_READY: 441 case HIDP_HSHK_ERR_INVALID_REPORT_ID: 442 case HIDP_HSHK_ERR_UNSUPPORTED_REQUEST: 443 case HIDP_HSHK_ERR_INVALID_PARAMETER: 444 if (test_and_clear_bit(HIDP_WAITING_FOR_RETURN, &session->flags)) 445 wake_up_interruptible(&session->report_queue); 446 447 /* FIXME: Call into SET_ GET_ handlers here */ 448 break; 449 450 case HIDP_HSHK_ERR_UNKNOWN: 451 break; 452 453 case HIDP_HSHK_ERR_FATAL: 454 /* Device requests a reboot, as this is the only way this error 455 * can be recovered. */ 456 hidp_send_ctrl_message(session, 457 HIDP_TRANS_HID_CONTROL | HIDP_CTRL_SOFT_RESET, NULL, 0); 458 break; 459 460 default: 461 hidp_send_ctrl_message(session, 462 HIDP_TRANS_HANDSHAKE | HIDP_HSHK_ERR_INVALID_PARAMETER, NULL, 0); 463 break; 464 } 465 466 /* Wake up the waiting thread. */ 467 if (test_and_clear_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags)) 468 wake_up_interruptible(&session->report_queue); 469} 470 471static void hidp_process_hid_control(struct hidp_session *session, 472 unsigned char param) 473{ 474 BT_DBG("session %p param 0x%02x", session, param); 475 476 if (param == HIDP_CTRL_VIRTUAL_CABLE_UNPLUG) { 477 /* Flush the transmit queues */ 478 skb_queue_purge(&session->ctrl_transmit); 479 skb_queue_purge(&session->intr_transmit); 480 481 hidp_session_terminate(session); 482 } 483} 484 485/* Returns true if the passed-in skb should be freed by the caller. */ 486static int hidp_process_data(struct hidp_session *session, struct sk_buff *skb, 487 unsigned char param) 488{ 489 int done_with_skb = 1; 490 BT_DBG("session %p skb %p len %d param 0x%02x", session, skb, skb->len, param); 491 492 switch (param) { 493 case HIDP_DATA_RTYPE_INPUT: 494 hidp_set_timer(session); 495 496 if (session->input) 497 hidp_input_report(session, skb); 498 499 if (session->hid) 500 hid_input_report(session->hid, HID_INPUT_REPORT, skb->data, skb->len, 0); 501 break; 502 503 case HIDP_DATA_RTYPE_OTHER: 504 case HIDP_DATA_RTYPE_OUPUT: 505 case HIDP_DATA_RTYPE_FEATURE: 506 break; 507 508 default: 509 hidp_send_ctrl_message(session, 510 HIDP_TRANS_HANDSHAKE | HIDP_HSHK_ERR_INVALID_PARAMETER, NULL, 0); 511 } 512 513 if (test_bit(HIDP_WAITING_FOR_RETURN, &session->flags) && 514 param == session->waiting_report_type) { 515 if (session->waiting_report_number < 0 || 516 session->waiting_report_number == skb->data[0]) { 517 /* hidp_get_raw_report() is waiting on this report. */ 518 session->report_return = skb; 519 done_with_skb = 0; 520 clear_bit(HIDP_WAITING_FOR_RETURN, &session->flags); 521 wake_up_interruptible(&session->report_queue); 522 } 523 } 524 525 return done_with_skb; 526} 527 528static void hidp_recv_ctrl_frame(struct hidp_session *session, 529 struct sk_buff *skb) 530{ 531 unsigned char hdr, type, param; 532 int free_skb = 1; 533 534 BT_DBG("session %p skb %p len %d", session, skb, skb->len); 535 536 hdr = skb->data[0]; 537 skb_pull(skb, 1); 538 539 type = hdr & HIDP_HEADER_TRANS_MASK; 540 param = hdr & HIDP_HEADER_PARAM_MASK; 541 542 switch (type) { 543 case HIDP_TRANS_HANDSHAKE: 544 hidp_process_handshake(session, param); 545 break; 546 547 case HIDP_TRANS_HID_CONTROL: 548 hidp_process_hid_control(session, param); 549 break; 550 551 case HIDP_TRANS_DATA: 552 free_skb = hidp_process_data(session, skb, param); 553 break; 554 555 default: 556 hidp_send_ctrl_message(session, 557 HIDP_TRANS_HANDSHAKE | HIDP_HSHK_ERR_UNSUPPORTED_REQUEST, NULL, 0); 558 break; 559 } 560 561 if (free_skb) 562 kfree_skb(skb); 563} 564 565static void hidp_recv_intr_frame(struct hidp_session *session, 566 struct sk_buff *skb) 567{ 568 unsigned char hdr; 569 570 BT_DBG("session %p skb %p len %d", session, skb, skb->len); 571 572 hdr = skb->data[0]; 573 skb_pull(skb, 1); 574 575 if (hdr == (HIDP_TRANS_DATA | HIDP_DATA_RTYPE_INPUT)) { 576 hidp_set_timer(session); 577 578 if (session->input) 579 hidp_input_report(session, skb); 580 581 if (session->hid) { 582 hid_input_report(session->hid, HID_INPUT_REPORT, skb->data, skb->len, 1); 583 BT_DBG("report len %d", skb->len); 584 } 585 } else { 586 BT_DBG("Unsupported protocol header 0x%02x", hdr); 587 } 588 589 kfree_skb(skb); 590} 591 592static int hidp_send_frame(struct socket *sock, unsigned char *data, int len) 593{ 594 struct kvec iv = { data, len }; 595 struct msghdr msg; 596 597 BT_DBG("sock %p data %p len %d", sock, data, len); 598 599 if (!len) 600 return 0; 601 602 memset(&msg, 0, sizeof(msg)); 603 604 return kernel_sendmsg(sock, &msg, &iv, 1, len); 605} 606 607/* dequeue message from @transmit and send via @sock */ 608static void hidp_process_transmit(struct hidp_session *session, 609 struct sk_buff_head *transmit, 610 struct socket *sock) 611{ 612 struct sk_buff *skb; 613 int ret; 614 615 BT_DBG("session %p", session); 616 617 while ((skb = skb_dequeue(transmit))) { 618 ret = hidp_send_frame(sock, skb->data, skb->len); 619 if (ret == -EAGAIN) { 620 skb_queue_head(transmit, skb); 621 break; 622 } else if (ret < 0) { 623 hidp_session_terminate(session); 624 kfree_skb(skb); 625 break; 626 } 627 628 hidp_set_timer(session); 629 kfree_skb(skb); 630 } 631} 632 633static int hidp_setup_input(struct hidp_session *session, 634 struct hidp_connadd_req *req) 635{ 636 struct input_dev *input; 637 int i; 638 639 input = input_allocate_device(); 640 if (!input) 641 return -ENOMEM; 642 643 session->input = input; 644 645 input_set_drvdata(input, session); 646 647 input->name = "Bluetooth HID Boot Protocol Device"; 648 649 input->id.bustype = BUS_BLUETOOTH; 650 input->id.vendor = req->vendor; 651 input->id.product = req->product; 652 input->id.version = req->version; 653 654 if (req->subclass & 0x40) { 655 set_bit(EV_KEY, input->evbit); 656 set_bit(EV_LED, input->evbit); 657 set_bit(EV_REP, input->evbit); 658 659 set_bit(LED_NUML, input->ledbit); 660 set_bit(LED_CAPSL, input->ledbit); 661 set_bit(LED_SCROLLL, input->ledbit); 662 set_bit(LED_COMPOSE, input->ledbit); 663 set_bit(LED_KANA, input->ledbit); 664 665 for (i = 0; i < sizeof(hidp_keycode); i++) 666 set_bit(hidp_keycode[i], input->keybit); 667 clear_bit(0, input->keybit); 668 } 669 670 if (req->subclass & 0x80) { 671 input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); 672 input->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | 673 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); 674 input->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 675 input->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_SIDE) | 676 BIT_MASK(BTN_EXTRA); 677 input->relbit[0] |= BIT_MASK(REL_WHEEL); 678 } 679 680 input->dev.parent = &session->conn->hcon->dev; 681 682 input->event = hidp_input_event; 683 684 return 0; 685} 686 687static int hidp_open(struct hid_device *hid) 688{ 689 return 0; 690} 691 692static void hidp_close(struct hid_device *hid) 693{ 694} 695 696static int hidp_parse(struct hid_device *hid) 697{ 698 struct hidp_session *session = hid->driver_data; 699 700 return hid_parse_report(session->hid, session->rd_data, 701 session->rd_size); 702} 703 704static int hidp_start(struct hid_device *hid) 705{ 706 return 0; 707} 708 709static void hidp_stop(struct hid_device *hid) 710{ 711 struct hidp_session *session = hid->driver_data; 712 713 skb_queue_purge(&session->ctrl_transmit); 714 skb_queue_purge(&session->intr_transmit); 715 716 hid->claimed = 0; 717} 718 719static struct hid_ll_driver hidp_hid_driver = { 720 .parse = hidp_parse, 721 .start = hidp_start, 722 .stop = hidp_stop, 723 .open = hidp_open, 724 .close = hidp_close, 725 .hidinput_input_event = hidp_hidinput_event, 726}; 727 728/* This function sets up the hid device. It does not add it 729 to the HID system. That is done in hidp_add_connection(). */ 730static int hidp_setup_hid(struct hidp_session *session, 731 struct hidp_connadd_req *req) 732{ 733 struct hid_device *hid; 734 int err; 735 736 session->rd_data = kzalloc(req->rd_size, GFP_KERNEL); 737 if (!session->rd_data) 738 return -ENOMEM; 739 740 if (copy_from_user(session->rd_data, req->rd_data, req->rd_size)) { 741 err = -EFAULT; 742 goto fault; 743 } 744 session->rd_size = req->rd_size; 745 746 hid = hid_allocate_device(); 747 if (IS_ERR(hid)) { 748 err = PTR_ERR(hid); 749 goto fault; 750 } 751 752 session->hid = hid; 753 754 hid->driver_data = session; 755 756 hid->bus = BUS_BLUETOOTH; 757 hid->vendor = req->vendor; 758 hid->product = req->product; 759 hid->version = req->version; 760 hid->country = req->country; 761 762 strncpy(hid->name, req->name, sizeof(req->name) - 1); 763 764 snprintf(hid->phys, sizeof(hid->phys), "%pMR", 765 &bt_sk(session->ctrl_sock->sk)->src); 766 767 snprintf(hid->uniq, sizeof(hid->uniq), "%pMR", 768 &bt_sk(session->ctrl_sock->sk)->dst); 769 770 hid->dev.parent = &session->conn->hcon->dev; 771 hid->ll_driver = &hidp_hid_driver; 772 773 hid->hid_get_raw_report = hidp_get_raw_report; 774 hid->hid_output_raw_report = hidp_output_raw_report; 775 776 /* True if device is blacklisted in drivers/hid/hid-core.c */ 777 if (hid_ignore(hid)) { 778 hid_destroy_device(session->hid); 779 session->hid = NULL; 780 return -ENODEV; 781 } 782 783 return 0; 784 785fault: 786 kfree(session->rd_data); 787 session->rd_data = NULL; 788 789 return err; 790} 791 792/* initialize session devices */ 793static int hidp_session_dev_init(struct hidp_session *session, 794 struct hidp_connadd_req *req) 795{ 796 int ret; 797 798 if (req->rd_size > 0) { 799 ret = hidp_setup_hid(session, req); 800 if (ret && ret != -ENODEV) 801 return ret; 802 } 803 804 if (!session->hid) { 805 ret = hidp_setup_input(session, req); 806 if (ret < 0) 807 return ret; 808 } 809 810 return 0; 811} 812 813/* destroy session devices */ 814static void hidp_session_dev_destroy(struct hidp_session *session) 815{ 816 if (session->hid) 817 put_device(&session->hid->dev); 818 else if (session->input) 819 input_put_device(session->input); 820 821 kfree(session->rd_data); 822 session->rd_data = NULL; 823} 824 825/* add HID/input devices to their underlying bus systems */ 826static int hidp_session_dev_add(struct hidp_session *session) 827{ 828 int ret; 829 830 /* Both HID and input systems drop a ref-count when unregistering the 831 * device but they don't take a ref-count when registering them. Work 832 * around this by explicitly taking a refcount during registration 833 * which is dropped automatically by unregistering the devices. */ 834 835 if (session->hid) { 836 ret = hid_add_device(session->hid); 837 if (ret) 838 return ret; 839 get_device(&session->hid->dev); 840 } else if (session->input) { 841 ret = input_register_device(session->input); 842 if (ret) 843 return ret; 844 input_get_device(session->input); 845 } 846 847 return 0; 848} 849 850/* remove HID/input devices from their bus systems */ 851static void hidp_session_dev_del(struct hidp_session *session) 852{ 853 if (session->hid) 854 hid_destroy_device(session->hid); 855 else if (session->input) 856 input_unregister_device(session->input); 857} 858 859/* 860 * Asynchronous device registration 861 * HID device drivers might want to perform I/O during initialization to 862 * detect device types. Therefore, call device registration in a separate 863 * worker so the HIDP thread can schedule I/O operations. 864 * Note that this must be called after the worker thread was initialized 865 * successfully. This will then add the devices and increase session state 866 * on success, otherwise it will terminate the session thread. 867 */ 868static void hidp_session_dev_work(struct work_struct *work) 869{ 870 struct hidp_session *session = container_of(work, 871 struct hidp_session, 872 dev_init); 873 int ret; 874 875 ret = hidp_session_dev_add(session); 876 if (!ret) 877 atomic_inc(&session->state); 878 else 879 hidp_session_terminate(session); 880} 881 882/* 883 * Create new session object 884 * Allocate session object, initialize static fields, copy input data into the 885 * object and take a reference to all sub-objects. 886 * This returns 0 on success and puts a pointer to the new session object in 887 * \out. Otherwise, an error code is returned. 888 * The new session object has an initial ref-count of 1. 889 */ 890static int hidp_session_new(struct hidp_session **out, const bdaddr_t *bdaddr, 891 struct socket *ctrl_sock, 892 struct socket *intr_sock, 893 struct hidp_connadd_req *req, 894 struct l2cap_conn *conn) 895{ 896 struct hidp_session *session; 897 int ret; 898 struct bt_sock *ctrl, *intr; 899 900 ctrl = bt_sk(ctrl_sock->sk); 901 intr = bt_sk(intr_sock->sk); 902 903 session = kzalloc(sizeof(*session), GFP_KERNEL); 904 if (!session) 905 return -ENOMEM; 906 907 /* object and runtime management */ 908 kref_init(&session->ref); 909 atomic_set(&session->state, HIDP_SESSION_IDLING); 910 init_waitqueue_head(&session->state_queue); 911 session->flags = req->flags & (1 << HIDP_BLUETOOTH_VENDOR_ID); 912 913 /* connection management */ 914 bacpy(&session->bdaddr, bdaddr); 915 session->conn = conn; 916 session->user.probe = hidp_session_probe; 917 session->user.remove = hidp_session_remove; 918 session->ctrl_sock = ctrl_sock; 919 session->intr_sock = intr_sock; 920 skb_queue_head_init(&session->ctrl_transmit); 921 skb_queue_head_init(&session->intr_transmit); 922 session->ctrl_mtu = min_t(uint, l2cap_pi(ctrl)->chan->omtu, 923 l2cap_pi(ctrl)->chan->imtu); 924 session->intr_mtu = min_t(uint, l2cap_pi(intr)->chan->omtu, 925 l2cap_pi(intr)->chan->imtu); 926 session->idle_to = req->idle_to; 927 928 /* device management */ 929 INIT_WORK(&session->dev_init, hidp_session_dev_work); 930 setup_timer(&session->timer, hidp_idle_timeout, 931 (unsigned long)session); 932 933 /* session data */ 934 mutex_init(&session->report_mutex); 935 init_waitqueue_head(&session->report_queue); 936 937 ret = hidp_session_dev_init(session, req); 938 if (ret) 939 goto err_free; 940 941 l2cap_conn_get(session->conn); 942 get_file(session->intr_sock->file); 943 get_file(session->ctrl_sock->file); 944 *out = session; 945 return 0; 946 947err_free: 948 kfree(session); 949 return ret; 950} 951 952/* increase ref-count of the given session by one */ 953static void hidp_session_get(struct hidp_session *session) 954{ 955 kref_get(&session->ref); 956} 957 958/* release callback */ 959static void session_free(struct kref *ref) 960{ 961 struct hidp_session *session = container_of(ref, struct hidp_session, 962 ref); 963 964 hidp_session_dev_destroy(session); 965 skb_queue_purge(&session->ctrl_transmit); 966 skb_queue_purge(&session->intr_transmit); 967 fput(session->intr_sock->file); 968 fput(session->ctrl_sock->file); 969 l2cap_conn_put(session->conn); 970 kfree(session); 971} 972 973/* decrease ref-count of the given session by one */ 974static void hidp_session_put(struct hidp_session *session) 975{ 976 kref_put(&session->ref, session_free); 977} 978 979/* 980 * Search the list of active sessions for a session with target address 981 * \bdaddr. You must hold at least a read-lock on \hidp_session_sem. As long as 982 * you do not release this lock, the session objects cannot vanish and you can 983 * safely take a reference to the session yourself. 984 */ 985static struct hidp_session *__hidp_session_find(const bdaddr_t *bdaddr) 986{ 987 struct hidp_session *session; 988 989 list_for_each_entry(session, &hidp_session_list, list) { 990 if (!bacmp(bdaddr, &session->bdaddr)) 991 return session; 992 } 993 994 return NULL; 995} 996 997/* 998 * Same as __hidp_session_find() but no locks must be held. This also takes a 999 * reference of the returned session (if non-NULL) so you must drop this 1000 * reference if you no longer use the object. 1001 */ 1002static struct hidp_session *hidp_session_find(const bdaddr_t *bdaddr) 1003{ 1004 struct hidp_session *session; 1005 1006 down_read(&hidp_session_sem); 1007 1008 session = __hidp_session_find(bdaddr); 1009 if (session) 1010 hidp_session_get(session); 1011 1012 up_read(&hidp_session_sem); 1013 1014 return session; 1015} 1016 1017/* 1018 * Start session synchronously 1019 * This starts a session thread and waits until initialization 1020 * is done or returns an error if it couldn't be started. 1021 * If this returns 0 the session thread is up and running. You must call 1022 * hipd_session_stop_sync() before deleting any runtime resources. 1023 */ 1024static int hidp_session_start_sync(struct hidp_session *session) 1025{ 1026 unsigned int vendor, product; 1027 1028 if (session->hid) { 1029 vendor = session->hid->vendor; 1030 product = session->hid->product; 1031 } else if (session->input) { 1032 vendor = session->input->id.vendor; 1033 product = session->input->id.product; 1034 } else { 1035 vendor = 0x0000; 1036 product = 0x0000; 1037 } 1038 1039 session->task = kthread_run(hidp_session_thread, session, 1040 "khidpd_%04x%04x", vendor, product); 1041 if (IS_ERR(session->task)) 1042 return PTR_ERR(session->task); 1043 1044 while (atomic_read(&session->state) <= HIDP_SESSION_IDLING) 1045 wait_event(session->state_queue, 1046 atomic_read(&session->state) > HIDP_SESSION_IDLING); 1047 1048 return 0; 1049} 1050 1051/* 1052 * Terminate session thread 1053 * Wake up session thread and notify it to stop. This is asynchronous and 1054 * returns immediately. Call this whenever a runtime error occurs and you want 1055 * the session to stop. 1056 * Note: wake_up_process() performs any necessary memory-barriers for us. 1057 */ 1058static void hidp_session_terminate(struct hidp_session *session) 1059{ 1060 atomic_inc(&session->terminate); 1061 wake_up_process(session->task); 1062} 1063 1064/* 1065 * Probe HIDP session 1066 * This is called from the l2cap_conn core when our l2cap_user object is bound 1067 * to the hci-connection. We get the session via the \user object and can now 1068 * start the session thread, link it into the global session list and 1069 * schedule HID/input device registration. 1070 * The global session-list owns its own reference to the session object so you 1071 * can drop your own reference after registering the l2cap_user object. 1072 */ 1073static int hidp_session_probe(struct l2cap_conn *conn, 1074 struct l2cap_user *user) 1075{ 1076 struct hidp_session *session = container_of(user, 1077 struct hidp_session, 1078 user); 1079 struct hidp_session *s; 1080 int ret; 1081 1082 down_write(&hidp_session_sem); 1083 1084 /* check that no other session for this device exists */ 1085 s = __hidp_session_find(&session->bdaddr); 1086 if (s) { 1087 ret = -EEXIST; 1088 goto out_unlock; 1089 } 1090 1091 if (session->input) { 1092 ret = hidp_session_dev_add(session); 1093 if (ret) 1094 goto out_unlock; 1095 } 1096 1097 ret = hidp_session_start_sync(session); 1098 if (ret) 1099 goto out_del; 1100 1101 /* HID device registration is async to allow I/O during probe */ 1102 if (session->input) 1103 atomic_inc(&session->state); 1104 else 1105 schedule_work(&session->dev_init); 1106 1107 hidp_session_get(session); 1108 list_add(&session->list, &hidp_session_list); 1109 ret = 0; 1110 goto out_unlock; 1111 1112out_del: 1113 if (session->input) 1114 hidp_session_dev_del(session); 1115out_unlock: 1116 up_write(&hidp_session_sem); 1117 return ret; 1118} 1119 1120/* 1121 * Remove HIDP session 1122 * Called from the l2cap_conn core when either we explicitly unregistered 1123 * the l2cap_user object or if the underlying connection is shut down. 1124 * We signal the hidp-session thread to shut down, unregister the HID/input 1125 * devices and unlink the session from the global list. 1126 * This drops the reference to the session that is owned by the global 1127 * session-list. 1128 * Note: We _must_ not synchronosly wait for the session-thread to shut down. 1129 * This is, because the session-thread might be waiting for an HCI lock that is 1130 * held while we are called. Therefore, we only unregister the devices and 1131 * notify the session-thread to terminate. The thread itself owns a reference 1132 * to the session object so it can safely shut down. 1133 */ 1134static void hidp_session_remove(struct l2cap_conn *conn, 1135 struct l2cap_user *user) 1136{ 1137 struct hidp_session *session = container_of(user, 1138 struct hidp_session, 1139 user); 1140 1141 down_write(&hidp_session_sem); 1142 1143 hidp_session_terminate(session); 1144 1145 cancel_work_sync(&session->dev_init); 1146 if (session->input || 1147 atomic_read(&session->state) > HIDP_SESSION_PREPARING) 1148 hidp_session_dev_del(session); 1149 1150 list_del(&session->list); 1151 1152 up_write(&hidp_session_sem); 1153 1154 hidp_session_put(session); 1155} 1156 1157/* 1158 * Session Worker 1159 * This performs the actual main-loop of the HIDP worker. We first check 1160 * whether the underlying connection is still alive, then parse all pending 1161 * messages and finally send all outstanding messages. 1162 */ 1163static void hidp_session_run(struct hidp_session *session) 1164{ 1165 struct sock *ctrl_sk = session->ctrl_sock->sk; 1166 struct sock *intr_sk = session->intr_sock->sk; 1167 struct sk_buff *skb; 1168 1169 for (;;) { 1170 /* 1171 * This thread can be woken up two ways: 1172 * - You call hidp_session_terminate() which sets the 1173 * session->terminate flag and wakes this thread up. 1174 * - Via modifying the socket state of ctrl/intr_sock. This 1175 * thread is woken up by ->sk_state_changed(). 1176 * 1177 * Note: set_current_state() performs any necessary 1178 * memory-barriers for us. 1179 */ 1180 set_current_state(TASK_INTERRUPTIBLE); 1181 1182 if (atomic_read(&session->terminate)) 1183 break; 1184 1185 if (ctrl_sk->sk_state != BT_CONNECTED || 1186 intr_sk->sk_state != BT_CONNECTED) 1187 break; 1188 1189 /* parse incoming intr-skbs */ 1190 while ((skb = skb_dequeue(&intr_sk->sk_receive_queue))) { 1191 skb_orphan(skb); 1192 if (!skb_linearize(skb)) 1193 hidp_recv_intr_frame(session, skb); 1194 else 1195 kfree_skb(skb); 1196 } 1197 1198 /* send pending intr-skbs */ 1199 hidp_process_transmit(session, &session->intr_transmit, 1200 session->intr_sock); 1201 1202 /* parse incoming ctrl-skbs */ 1203 while ((skb = skb_dequeue(&ctrl_sk->sk_receive_queue))) { 1204 skb_orphan(skb); 1205 if (!skb_linearize(skb)) 1206 hidp_recv_ctrl_frame(session, skb); 1207 else 1208 kfree_skb(skb); 1209 } 1210 1211 /* send pending ctrl-skbs */ 1212 hidp_process_transmit(session, &session->ctrl_transmit, 1213 session->ctrl_sock); 1214 1215 schedule(); 1216 } 1217 1218 atomic_inc(&session->terminate); 1219 set_current_state(TASK_RUNNING); 1220} 1221 1222/* 1223 * HIDP session thread 1224 * This thread runs the I/O for a single HIDP session. Startup is synchronous 1225 * which allows us to take references to ourself here instead of doing that in 1226 * the caller. 1227 * When we are ready to run we notify the caller and call hidp_session_run(). 1228 */ 1229static int hidp_session_thread(void *arg) 1230{ 1231 struct hidp_session *session = arg; 1232 wait_queue_t ctrl_wait, intr_wait; 1233 1234 BT_DBG("session %p", session); 1235 1236 /* initialize runtime environment */ 1237 hidp_session_get(session); 1238 __module_get(THIS_MODULE); 1239 set_user_nice(current, -15); 1240 hidp_set_timer(session); 1241 1242 init_waitqueue_entry(&ctrl_wait, current); 1243 init_waitqueue_entry(&intr_wait, current); 1244 add_wait_queue(sk_sleep(session->ctrl_sock->sk), &ctrl_wait); 1245 add_wait_queue(sk_sleep(session->intr_sock->sk), &intr_wait); 1246 /* This memory barrier is paired with wq_has_sleeper(). See 1247 * sock_poll_wait() for more information why this is needed. */ 1248 smp_mb(); 1249 1250 /* notify synchronous startup that we're ready */ 1251 atomic_inc(&session->state); 1252 wake_up(&session->state_queue); 1253 1254 /* run session */ 1255 hidp_session_run(session); 1256 1257 /* cleanup runtime environment */ 1258 remove_wait_queue(sk_sleep(session->intr_sock->sk), &intr_wait); 1259 remove_wait_queue(sk_sleep(session->intr_sock->sk), &ctrl_wait); 1260 wake_up_interruptible(&session->report_queue); 1261 hidp_del_timer(session); 1262 1263 /* 1264 * If we stopped ourself due to any internal signal, we should try to 1265 * unregister our own session here to avoid having it linger until the 1266 * parent l2cap_conn dies or user-space cleans it up. 1267 * This does not deadlock as we don't do any synchronous shutdown. 1268 * Instead, this call has the same semantics as if user-space tried to 1269 * delete the session. 1270 */ 1271 l2cap_unregister_user(session->conn, &session->user); 1272 hidp_session_put(session); 1273 1274 module_put_and_exit(0); 1275 return 0; 1276} 1277 1278static int hidp_verify_sockets(struct socket *ctrl_sock, 1279 struct socket *intr_sock) 1280{ 1281 struct bt_sock *ctrl, *intr; 1282 struct hidp_session *session; 1283 1284 if (!l2cap_is_socket(ctrl_sock) || !l2cap_is_socket(intr_sock)) 1285 return -EINVAL; 1286 1287 ctrl = bt_sk(ctrl_sock->sk); 1288 intr = bt_sk(intr_sock->sk); 1289 1290 if (bacmp(&ctrl->src, &intr->src) || bacmp(&ctrl->dst, &intr->dst)) 1291 return -ENOTUNIQ; 1292 if (ctrl->sk.sk_state != BT_CONNECTED || 1293 intr->sk.sk_state != BT_CONNECTED) 1294 return -EBADFD; 1295 1296 /* early session check, we check again during session registration */ 1297 session = hidp_session_find(&ctrl->dst); 1298 if (session) { 1299 hidp_session_put(session); 1300 return -EEXIST; 1301 } 1302 1303 return 0; 1304} 1305 1306int hidp_connection_add(struct hidp_connadd_req *req, 1307 struct socket *ctrl_sock, 1308 struct socket *intr_sock) 1309{ 1310 struct hidp_session *session; 1311 struct l2cap_conn *conn; 1312 struct l2cap_chan *chan = l2cap_pi(ctrl_sock->sk)->chan; 1313 int ret; 1314 1315 ret = hidp_verify_sockets(ctrl_sock, intr_sock); 1316 if (ret) 1317 return ret; 1318 1319 conn = NULL; 1320 l2cap_chan_lock(chan); 1321 if (chan->conn) { 1322 l2cap_conn_get(chan->conn); 1323 conn = chan->conn; 1324 } 1325 l2cap_chan_unlock(chan); 1326 1327 if (!conn) 1328 return -EBADFD; 1329 1330 ret = hidp_session_new(&session, &bt_sk(ctrl_sock->sk)->dst, ctrl_sock, 1331 intr_sock, req, conn); 1332 if (ret) 1333 goto out_conn; 1334 1335 ret = l2cap_register_user(conn, &session->user); 1336 if (ret) 1337 goto out_session; 1338 1339 ret = 0; 1340 1341out_session: 1342 hidp_session_put(session); 1343out_conn: 1344 l2cap_conn_put(conn); 1345 return ret; 1346} 1347 1348int hidp_connection_del(struct hidp_conndel_req *req) 1349{ 1350 struct hidp_session *session; 1351 1352 session = hidp_session_find(&req->bdaddr); 1353 if (!session) 1354 return -ENOENT; 1355 1356 if (req->flags & (1 << HIDP_VIRTUAL_CABLE_UNPLUG)) 1357 hidp_send_ctrl_message(session, 1358 HIDP_TRANS_HID_CONTROL | 1359 HIDP_CTRL_VIRTUAL_CABLE_UNPLUG, 1360 NULL, 0); 1361 else 1362 l2cap_unregister_user(session->conn, &session->user); 1363 1364 hidp_session_put(session); 1365 1366 return 0; 1367} 1368 1369int hidp_get_connlist(struct hidp_connlist_req *req) 1370{ 1371 struct hidp_session *session; 1372 int err = 0, n = 0; 1373 1374 BT_DBG(""); 1375 1376 down_read(&hidp_session_sem); 1377 1378 list_for_each_entry(session, &hidp_session_list, list) { 1379 struct hidp_conninfo ci; 1380 1381 hidp_copy_session(session, &ci); 1382 1383 if (copy_to_user(req->ci, &ci, sizeof(ci))) { 1384 err = -EFAULT; 1385 break; 1386 } 1387 1388 if (++n >= req->cnum) 1389 break; 1390 1391 req->ci++; 1392 } 1393 req->cnum = n; 1394 1395 up_read(&hidp_session_sem); 1396 return err; 1397} 1398 1399int hidp_get_conninfo(struct hidp_conninfo *ci) 1400{ 1401 struct hidp_session *session; 1402 1403 session = hidp_session_find(&ci->bdaddr); 1404 if (session) { 1405 hidp_copy_session(session, ci); 1406 hidp_session_put(session); 1407 } 1408 1409 return session ? 0 : -ENOENT; 1410} 1411 1412static int __init hidp_init(void) 1413{ 1414 BT_INFO("HIDP (Human Interface Emulation) ver %s", VERSION); 1415 1416 return hidp_init_sockets(); 1417} 1418 1419static void __exit hidp_exit(void) 1420{ 1421 hidp_cleanup_sockets(); 1422} 1423 1424module_init(hidp_init); 1425module_exit(hidp_exit); 1426 1427MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); 1428MODULE_AUTHOR("David Herrmann <dh.herrmann@gmail.com>"); 1429MODULE_DESCRIPTION("Bluetooth HIDP ver " VERSION); 1430MODULE_VERSION(VERSION); 1431MODULE_LICENSE("GPL"); 1432MODULE_ALIAS("bt-proto-6"); 1433