35
35
# for __version__
36
36
import adafruit_ble
37
37
38
- from bleio import Attribute , Characteristic , Descriptor , Peripheral , Service , UUID
38
+ from _bleio import Attribute , Characteristic , Descriptor , Peripheral , Service , UUID
39
39
from .advertising import ServerAdvertisement
40
40
from .device_information_service import DeviceInformationService
41
41
@@ -116,52 +116,52 @@ class HIDServer:
116
116
b'\x95 \x03 ' # Report Count (3)
117
117
b'\x91 \x01 ' # Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
118
118
b'\xC0 ' # End Collection
119
- # b'\x05\x01' # Usage Page (Generic Desktop Ctrls)
120
- # b'\x09\x02' # Usage (Mouse)
121
- # b'\xA1\x01' # Collection (Application)
122
- # b'\x09\x01' # Usage (Pointer)
123
- # b'\xA1\x00' # Collection (Physical)
124
- # b'\x85\x02' # Report ID (2)
125
- # b'\x05\x09' # Usage Page (Button)
126
- # b'\x19\x01' # Usage Minimum (\x01)
127
- # b'\x29\x05' # Usage Maximum (\x05)
128
- # b'\x15\x00' # Logical Minimum (0)
129
- # b'\x25\x01' # Logical Maximum (1)
130
- # b'\x95\x05' # Report Count (5)
131
- # b'\x75\x01' # Report Size (1)
132
- # b'\x81\x02' # Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
133
- # b'\x95\x01' # Report Count (1)
134
- # b'\x75\x03' # Report Size (3)
135
- # b'\x81\x01' # Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
136
- # b'\x05\x01' # Usage Page (Generic Desktop Ctrls)
137
- # b'\x09\x30' # Usage (X)
138
- # b'\x09\x31' # Usage (Y)
139
- # b'\x15\x81' # Logical Minimum (-127)
140
- # b'\x25\x7F' # Logical Maximum (127)
141
- # b'\x75\x08' # Report Size (8)
142
- # b'\x95\x02' # Report Count (2)
143
- # b'\x81\x06' # Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
144
- # b'\x09\x38' # Usage (Wheel)
145
- # b'\x15\x81' # Logical Minimum (-127)
146
- # b'\x25\x7F' # Logical Maximum (127)
147
- # b'\x75\x08' # Report Size (8)
148
- # b'\x95\x01' # Report Count (1)
149
- # b'\x81\x06' # Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
150
- # b'\xC0' # End Collection
151
- # b'\xC0' # End Collection
152
- # b'\x05\x0C' # Usage Page (Consumer)
153
- # b'\x09\x01' # Usage (Consumer Control)
154
- # b'\xA1\x01' # Collection (Application)
155
- # b'\x85\x03' # Report ID (3)
156
- # b'\x75\x10' # Report Size (16)
157
- # b'\x95\x01' # Report Count (1)
158
- # b'\x15\x01' # Logical Minimum (1)
159
- # b'\x26\x8C\x02' # Logical Maximum (652)
160
- # b'\x19\x01' # Usage Minimum (Consumer Control)
161
- # b'\x2A\x8C\x02' # Usage Maximum (AC Send)
162
- # b'\x81\x00' # Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
163
- # b'\xC0' # End Collection
164
- # b'\x05\x01' # Usage Page (Generic Desktop Ctrls)
119
+ b'\x05 \x01 ' # Usage Page (Generic Desktop Ctrls)
120
+ b'\x09 \x02 ' # Usage (Mouse)
121
+ b'\xA1 \x01 ' # Collection (Application)
122
+ b'\x09 \x01 ' # Usage (Pointer)
123
+ b'\xA1 \x00 ' # Collection (Physical)
124
+ b'\x85 \x02 ' # Report ID (2)
125
+ b'\x05 \x09 ' # Usage Page (Button)
126
+ b'\x19 \x01 ' # Usage Minimum (\x01)
127
+ b'\x29 \x05 ' # Usage Maximum (\x05)
128
+ b'\x15 \x00 ' # Logical Minimum (0)
129
+ b'\x25 \x01 ' # Logical Maximum (1)
130
+ b'\x95 \x05 ' # Report Count (5)
131
+ b'\x75 \x01 ' # Report Size (1)
132
+ b'\x81 \x02 ' # Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
133
+ b'\x95 \x01 ' # Report Count (1)
134
+ b'\x75 \x03 ' # Report Size (3)
135
+ b'\x81 \x01 ' # Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
136
+ b'\x05 \x01 ' # Usage Page (Generic Desktop Ctrls)
137
+ b'\x09 \x30 ' # Usage (X)
138
+ b'\x09 \x31 ' # Usage (Y)
139
+ b'\x15 \x81 ' # Logical Minimum (-127)
140
+ b'\x25 \x7F ' # Logical Maximum (127)
141
+ b'\x75 \x08 ' # Report Size (8)
142
+ b'\x95 \x02 ' # Report Count (2)
143
+ b'\x81 \x06 ' # Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
144
+ b'\x09 \x38 ' # Usage (Wheel)
145
+ b'\x15 \x81 ' # Logical Minimum (-127)
146
+ b'\x25 \x7F ' # Logical Maximum (127)
147
+ b'\x75 \x08 ' # Report Size (8)
148
+ b'\x95 \x01 ' # Report Count (1)
149
+ b'\x81 \x06 ' # Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
150
+ b'\xC0 ' # End Collection
151
+ b'\xC0 ' # End Collection
152
+ b'\x05 \x0C ' # Usage Page (Consumer)
153
+ b'\x09 \x01 ' # Usage (Consumer Control)
154
+ b'\xA1 \x01 ' # Collection (Application)
155
+ b'\x85 \x03 ' # Report ID (3)
156
+ b'\x75 \x10 ' # Report Size (16)
157
+ b'\x95 \x01 ' # Report Count (1)
158
+ b'\x15 \x01 ' # Logical Minimum (1)
159
+ b'\x26 \x8C \x02 ' # Logical Maximum (652)
160
+ b'\x19 \x01 ' # Usage Minimum (Consumer Control)
161
+ b'\x2A \x8C \x02 ' # Usage Maximum (AC Send)
162
+ b'\x81 \x00 ' # Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
163
+ b'\xC0 ' # End Collection
164
+ b'\x05 \x01 ' # Usage Page (Generic Desktop Ctrls)
165
165
# b'\x09\x05' # Usage (Game Pad)
166
166
# b'\xA1\x01' # Collection (Application)
167
167
# b'\x85\x05' # Report ID (5)
@@ -198,8 +198,8 @@ class HIDServer:
198
198
199
199
_INPUT_REPORT_SIZES = {
200
200
REPORT_ID_KEYBOARD : 8 ,
201
- # REPORT_ID_MOUSE : 4,
202
- # REPORT_ID_CONSUMER_CONTROL : 2,
201
+ REPORT_ID_MOUSE : 4 ,
202
+ REPORT_ID_CONSUMER_CONTROL : 2 ,
203
203
# REPORT_ID_GAMEPAD : 6,
204
204
}
205
205
@@ -215,7 +215,7 @@ def __init__(self, name=None, tx_power=0):
215
215
self ._periph , software_revision = adafruit_ble .__version__ ,
216
216
manufacturer = "Adafruit Industries" )
217
217
218
- hid_service = Service .add_to_peripheral (UUID (_HID_SERVICE_UUID_NUM ))
218
+ hid_service = Service .add_to_peripheral (self . _periph , UUID (_HID_SERVICE_UUID_NUM ))
219
219
220
220
self ._input_chars = {}
221
221
for report_id in sorted (self ._INPUT_REPORT_SIZES .keys ()):
0 commit comments