Skip to content

Commit 74bcde3

Browse files
committed
drv/technic_hub/bluetooth: respond to find by type value request
Windows has recently started sending a find by type value request. We need to send some sort of response, otherwise Bluetooth just hangs. For now, we just send an error, but could implement this properly in the future. Issue: pybricks/support#136
1 parent 5f4de97 commit 74bcde3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/pbio/drv/technic_hub/bluetooth.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,28 @@ static void handle_event(uint8_t *packet) {
359359
ATT_ExchangeMTURsp(connection_handle, &rsp);
360360
}
361361
break;
362+
363+
case ATT_EVENT_FIND_BY_TYPE_VALUE_REQ: {
364+
uint16_t start_handle = (data[7] << 8) | data[6];
365+
uint16_t end_handle = (data[9] << 8) | data[8];
366+
uint16_t type = (data[11] << 8) | data[10];
367+
uint8_t *value = &data[12];
368+
369+
UNUSED(start_handle);
370+
UNUSED(end_handle);
371+
UNUSED(type);
372+
UNUSED(value);
373+
374+
DBG("s %04X t %04X", start_handle, type);
375+
attErrorRsp_t rsp;
376+
377+
rsp.reqOpcode = ATT_FIND_BY_TYPE_VALUE_REQ;
378+
rsp.handle = start_handle;
379+
rsp.errCode = ATT_ERR_UNSUPPORTED_REQ;
380+
ATT_ErrorRsp(connection_handle, &rsp);
381+
}
382+
break;
383+
362384
case ATT_EVENT_READ_BY_TYPE_REQ: {
363385
uint16_t start_handle = (data[7] << 8) | data[6];
364386
uint16_t end_handle = (data[9] << 8) | data[8];

0 commit comments

Comments
 (0)