Skip to content

Commit 89e8cdb

Browse files
committed
restore unimplemented boot keyboard and mouse
1 parent 0445d12 commit 89e8cdb

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

adafruit_ble/hid_server.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The MIT License (MIT)
1+
# The MIT License (MIT)
22
#
33
# Copyright (c) 2019 Dan Halbert for Adafruit Industries
44
#
@@ -239,24 +239,24 @@ def __init__(self, name=None, tx_power=0):
239239
# Protocol mode: boot or report. Make it read-only for now because
240240
# it can't be changed
241241

242-
# protocol_mode_char = Characteristic(
243-
# UUID(_PROTOCOL_MODE_UUID_NUM), properties=Characteristic.READ | Characteristic.WRITE_NO_RESPONSE,
244-
# read_perm=Attribute.OPEN, write_perm=Attribute.OPEN,
245-
# max_length=1, fixed_length=True)
246-
# protocol_mode_char.value = _PROTOCOL_MODE_REPORT
247-
248-
# boot_keyboard_input_report = Characteristic(
249-
# UUID(_BOOT_KEYBOARD_INPUT_REPORT_UUID_NUM),
250-
# properties=Characteristic.READ | Characteristic.NOTIFY,
251-
# read_perm=Attribute.ENCRYPT_NO_MITM, write_perm=Attribute.NO_ACCESS,
252-
# max_length=self._INPUT_REPORT_SIZES[self.REPORT_ID_KEYBOARD], fixed_length=True)
253-
254-
# boot_keyboard_output_report = Characteristic(
255-
# UUID(_BOOT_KEYBOARD_OUTPUT_REPORT_UUID_NUM),
256-
# properties=(Characteristic.READ | Characteristic.WRITE |
257-
# Characteristic.WRITE_NO_RESPONSE),
258-
# read_perm=Attribute.ENCRYPT_NO_MITM, write_perm=Attribute.ENCRYPT_NO_MITM,
259-
# max_length=self._OUTPUT_REPORT_SIZES[self.REPORT_ID_KEYBOARD], fixed_length=True)
242+
protocol_mode_char = Characteristic(
243+
UUID(_PROTOCOL_MODE_UUID_NUM), properties=Characteristic.READ | Characteristic.WRITE_NO_RESPONSE,
244+
read_perm=Attribute.OPEN, write_perm=Attribute.OPEN,
245+
max_length=1, fixed_length=True)
246+
protocol_mode_char.value = _PROTOCOL_MODE_REPORT
247+
248+
boot_keyboard_input_report = Characteristic(
249+
UUID(_BOOT_KEYBOARD_INPUT_REPORT_UUID_NUM),
250+
properties=Characteristic.READ | Characteristic.NOTIFY,
251+
read_perm=Attribute.ENCRYPT_NO_MITM, write_perm=Attribute.NO_ACCESS,
252+
max_length=self._INPUT_REPORT_SIZES[self.REPORT_ID_KEYBOARD], fixed_length=True)
253+
254+
boot_keyboard_output_report = Characteristic(
255+
UUID(_BOOT_KEYBOARD_OUTPUT_REPORT_UUID_NUM),
256+
properties=(Characteristic.READ | Characteristic.WRITE |
257+
Characteristic.WRITE_NO_RESPONSE),
258+
read_perm=Attribute.ENCRYPT_NO_MITM, write_perm=Attribute.ENCRYPT_NO_MITM,
259+
max_length=self._OUTPUT_REPORT_SIZES[self.REPORT_ID_KEYBOARD], fixed_length=True)
260260

261261
# This is the USB HID descriptor (not to be confused with a BLE Descriptor).
262262
report_map_char = Characteristic(
@@ -283,9 +283,9 @@ def __init__(self, name=None, tx_power=0):
283283
hid_service = Service(UUID(_HID_SERVICE_UUID_NUM),
284284
tuple(self._input_chars.values()) +
285285
tuple(self._output_chars.values()) +
286-
(#boot_keyboard_input_report,
287-
#boot_keyboard_output_report,
288-
#protocol_mode_char,
286+
(boot_keyboard_input_report,
287+
boot_keyboard_output_report,
288+
protocol_mode_char,
289289
report_map_char,
290290
hid_information_char,
291291
self._hid_control_point_char,

0 commit comments

Comments
 (0)