Skip to content

Commit e306214

Browse files
committed
1 parent 7047e49 commit e306214

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

hid_services.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
F_READ_NOTIFY = bluetooth.FLAG_READ | bluetooth.FLAG_NOTIFY
2929
F_READ_WRITE_NORESPONSE = bluetooth.FLAG_READ | bluetooth.FLAG_WRITE | bluetooth.FLAG_WRITE_NO_RESPONSE
3030

31-
ATT_F_READ = 0x01
32-
ATT_F_WRITE = 0x02
33-
ATT_F_READ_WRITE = ATT_F_READ | ATT_F_WRITE
31+
DSC_F_READ = 0x02
32+
DSC_F_WRITE = 0x03
3433

3534
# Advertising payloads are repeated packets of the following form:
3635
# 1 byte data length (N + 1)
@@ -250,8 +249,8 @@ def __init__(self, device_name="Generic HID Device"):
250249
UUID(0x180F), # 0x180F = Battery Information.
251250
(
252251
(UUID(0x2A19), F_READ_NOTIFY, ( # 0x2A19 = Battery level, to be read by client after being notified of change.
253-
(UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration.
254-
(UUID(0x2904), ATT_F_READ), # 0x2904 = Characteristic Presentation Format.
252+
(UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration.
253+
(UUID(0x2904), DSC_F_READ), # 0x2904 = Characteristic Presentation Format.
255254
)),
256255
),
257256
)
@@ -626,8 +625,8 @@ def __init__(self, name="Bluetooth Joystick"):
626625
(UUID(0x2A4B), F_READ), # 0x2A4B = HID USB report map, to be read by client.
627626
(UUID(0x2A4C), F_READ_WRITE_NORESPONSE), # 0x2A4C = HID control point, to be written by client.
628627
(UUID(0x2A4D), F_READ_NOTIFY, ( # 0x2A4D = HID report, to be read by client after notification.
629-
(UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration.
630-
(UUID(0x2908), ATT_F_READ_WRITE), # 0x2908 = HID reference, to be read by client (allow write because MicroPython v1.20+ bug).
628+
(UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration.
629+
(UUID(0x2908), DSC_F_READ), # 0x2908 = HID reference, to be read by client.
631630
)),
632631
(UUID(0x2A4E), F_READ_WRITE_NORESPONSE), # 0x2A4E = HID protocol mode, to be written & read by client.
633632
),
@@ -753,8 +752,8 @@ def __init__(self, name="Bluetooth Mouse"):
753752
(UUID(0x2A4B), F_READ), # 0x2A4B = HID report map, to be read by client.
754753
(UUID(0x2A4C), F_READ_WRITE_NORESPONSE), # 0x2A4C = HID control point, to be written by client.
755754
(UUID(0x2A4D), F_READ_NOTIFY, ( # 0x2A4D = HID report, to be read by client after notification.
756-
(UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration.
757-
(UUID(0x2908), ATT_F_READ_WRITE), # 0x2908 = HID reference, to be read by client (allow write because MicroPython v1.20+ bug).
755+
(UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration.
756+
(UUID(0x2908), DSC_F_READ), # 0x2908 = HID reference, to be read by client.
758757
)),
759758
(UUID(0x2A4E), F_READ_WRITE_NORESPONSE), # 0x2A4E = HID protocol mode, to be written & read by client.
760759
),
@@ -886,12 +885,12 @@ def __init__(self, name="Bluetooth Keyboard"):
886885
(UUID(0x2A4B), F_READ), # 0x2A4B = HID report map, to be read by client.
887886
(UUID(0x2A4C), F_READ_WRITE_NORESPONSE), # 0x2A4C = HID control point, to be written by client.
888887
(UUID(0x2A4D), F_READ_NOTIFY, ( # 0x2A4D = HID report, to be read by client after notification.
889-
(UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration.
890-
(UUID(0x2908), ATT_F_READ_WRITE), # 0x2908 = HID reference, to be read by client (allow write because MicroPython v1.20+ bug).
888+
(UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration.
889+
(UUID(0x2908), DSC_F_READ), # 0x2908 = HID reference, to be read by client.
891890
)),
892891
(UUID(0x2A4D), F_READ_WRITE, ( # 0x2A4D = HID report
893-
(UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration.
894-
(UUID(0x2908), ATT_F_READ_WRITE), # 0x2908 = HID reference, to be read by client (allow write because MicroPython v1.20+ bug).
892+
(UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration.
893+
(UUID(0x2908), DSC_F_READ), # 0x2908 = HID reference, to be read by client.
895894
)),
896895
(UUID(0x2A4E), F_READ_WRITE_NORESPONSE), # 0x2A4E = HID protocol mode, to be written & read by client.
897896
),

0 commit comments

Comments
 (0)