| OLD | NEW |
| 1 /* | 1 /* |
| 2 HIDP implementation for Linux Bluetooth stack (BlueZ). | 2 HIDP implementation for Linux Bluetooth stack (BlueZ). |
| 3 Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> | 3 Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> |
| 4 | 4 |
| 5 This program is free software; you can redistribute it and/or modify | 5 This program is free software; you can redistribute it and/or modify |
| 6 it under the terms of the GNU General Public License version 2 as | 6 it under the terms of the GNU General Public License version 2 as |
| 7 published by the Free Software Foundation; | 7 published by the Free Software Foundation; |
| 8 | 8 |
| 9 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 9 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 10 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 10 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 rsize = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 307 rsize = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
| 308 if (rsize > sizeof(buf)) | 308 if (rsize > sizeof(buf)) |
| 309 return -EIO; | 309 return -EIO; |
| 310 | 310 |
| 311 hid_output_report(report, buf); | 311 hid_output_report(report, buf); |
| 312 | 312 |
| 313 return hidp_queue_report(session, buf, rsize); | 313 return hidp_queue_report(session, buf, rsize); |
| 314 } | 314 } |
| 315 | 315 |
| 316 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) | 316 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) |
| 317 static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, s
ize_t count, | 317 static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, s
ize_t count, |
| 318 unsigned char report_type) | 318 unsigned char report_type) |
| 319 { | 319 { |
| 320 switch (report_type) { | 320 switch (report_type) { |
| 321 case HID_FEATURE_REPORT: | 321 case HID_FEATURE_REPORT: |
| 322 report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE; | 322 report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE; |
| 323 break; | 323 break; |
| 324 case HID_OUTPUT_REPORT: | 324 case HID_OUTPUT_REPORT: |
| 325 report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT; | 325 report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT; |
| 326 break; | 326 break; |
| 327 default: | 327 default: |
| 328 return -EINVAL; | 328 return -EINVAL; |
| 329 } | 329 } |
| 330 | 330 |
| 331 if (hidp_send_ctrl_message(hid->driver_data, report_type, | 331 if (hidp_send_ctrl_message(hid->driver_data, report_type, |
| 332 data, count)) | 332 data, count)) |
| 333 return -ENOMEM; | 333 return -ENOMEM; |
| 334 return count; | 334 return count; |
| 335 } | 335 } |
| 336 #elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) |
| 337 static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, s
ize_t count) |
| 338 { |
| 339 if (hidp_send_ctrl_message(hid->driver_data, |
| 340 HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE, |
| 341 data, count)) |
| 342 return -ENOMEM; |
| 343 return count; |
| 344 } |
| 336 #endif | 345 #endif |
| 337 | 346 |
| 338 static void hidp_idle_timeout(unsigned long arg) | 347 static void hidp_idle_timeout(unsigned long arg) |
| 339 { | 348 { |
| 340 struct hidp_session *session = (struct hidp_session *) arg; | 349 struct hidp_session *session = (struct hidp_session *) arg; |
| 341 | 350 |
| 342 atomic_inc(&session->terminate); | 351 atomic_inc(&session->terminate); |
| 343 hidp_schedule(session); | 352 hidp_schedule(session); |
| 344 } | 353 } |
| 345 | 354 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 | 600 |
| 592 down_write(&hidp_session_sem); | 601 down_write(&hidp_session_sem); |
| 593 | 602 |
| 594 hidp_del_timer(session); | 603 hidp_del_timer(session); |
| 595 | 604 |
| 596 if (session->input) { | 605 if (session->input) { |
| 597 input_unregister_device(session->input); | 606 input_unregister_device(session->input); |
| 598 session->input = NULL; | 607 session->input = NULL; |
| 599 } | 608 } |
| 600 | 609 |
| 601 if (session->hid) { | 610 » if (session->hid) { |
| 602 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) | 611 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) |
| 603 hid_destroy_device(session->hid); | 612 » » hid_destroy_device(session->hid); |
| 604 session->hid = NULL; | 613 » » session->hid = NULL; |
| 605 #else | 614 #else |
| 606 if (session->hid->claimed & HID_CLAIMED_INPUT) | 615 » » if (session->hid->claimed & HID_CLAIMED_INPUT) |
| 607 hidinput_disconnect(session->hid); | 616 » » » hidinput_disconnect(session->hid); |
| 608 hid_free_device(session->hid); | 617 » » hid_free_device(session->hid); |
| 609 #endif | 618 #endif |
| 610 } | 619 » } |
| 611 | 620 |
| 612 /* Wakeup user-space polling for socket errors */ | 621 /* Wakeup user-space polling for socket errors */ |
| 613 session->intr_sock->sk->sk_err = EUNATCH; | 622 session->intr_sock->sk->sk_err = EUNATCH; |
| 614 session->ctrl_sock->sk->sk_err = EUNATCH; | 623 session->ctrl_sock->sk->sk_err = EUNATCH; |
| 615 | 624 |
| 616 hidp_schedule(session); | 625 hidp_schedule(session); |
| 617 | 626 |
| 618 fput(session->intr_sock->file); | 627 fput(session->intr_sock->file); |
| 619 | 628 |
| 620 wait_event_timeout(*(sk_sleep(ctrl_sk)), | 629 wait_event_timeout(*(sk_sleep(ctrl_sk)), |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 } | 1186 } |
| 1178 | 1187 |
| 1179 module_init(hidp_init); | 1188 module_init(hidp_init); |
| 1180 module_exit(hidp_exit); | 1189 module_exit(hidp_exit); |
| 1181 | 1190 |
| 1182 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); | 1191 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
| 1183 MODULE_DESCRIPTION("Bluetooth HIDP ver " VERSION); | 1192 MODULE_DESCRIPTION("Bluetooth HIDP ver " VERSION); |
| 1184 MODULE_VERSION(VERSION); | 1193 MODULE_VERSION(VERSION); |
| 1185 MODULE_LICENSE("GPL"); | 1194 MODULE_LICENSE("GPL"); |
| 1186 MODULE_ALIAS("bt-proto-6"); | 1195 MODULE_ALIAS("bt-proto-6"); |
| OLD | NEW |