瀏覽代碼

BT Mouse starting to return some data...

At least with the Tecknet mouse...

There are issues with binding when already trusted... Need to debug, also likewise if it times out and tries to restore the connection, but at least the beginning is getting some values
main
Kurt Eckhardt 6 年之前
父節點
當前提交
3cceff2173
共有 1 個檔案被更改,包括 21 行新增6 行删除
  1. +21
    -6
      mouse.cpp

+ 21
- 6
mouse.cpp 查看文件

@@ -124,21 +124,36 @@ bool MouseController::process_bluetooth_HID_data(const uint8_t *data, uint16_t l
// Example DATA from bluetooth keyboard:
// 0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7
// LEN D
//BT rx2_data(18): 48 20 e 0 a 0 70 0 a1 1 2 0 0 0 0 0 0 0
//BT rx2_data(18): 48 20 e 0 a 0 70 0 a1 1 2 0 4 0 0 0 0 0
//BT rx2_data(18): 48 20 e 0 a 0 70 0 a1 1 2 0 0 0 0 0 0 0
//BT rx2_data(14): b 20 a 0 6 0 71 0 a1 2 0 9 fe 0
//BT rx2_data(14): b 20 a 0 6 0 71 0 a1 2 0 8 fd 0
// So Len=9 passed in data starting at report ID=1...
USBHDBGSerial.printf("MouseController::process_bluetooth_HID_data\n");
if (length == 0) return false;
if (data[0] != 1) return false;
#ifdef USBHOST_PRINT_DEBUG
USBHDBGSerial.printf("MouseController::process_bluetooth_HID_data %d\n", length);
USBHDBGSerial.printf(" Mouse Data: ");
const uint8_t *p = (const uint8_t *)data;
uint16_t len = length;
do {
if (*p < 16) USBHDBGSerial.print('0');
USBHDBGSerial.print(*p++, HEX);
USBHDBGSerial.print(' ');
} while (--length);
} while (--len);
USBHDBGSerial.println();
#endif
// Looks like report 2 is for the mouse info.
if (data[0] != 2) return false;
buttons = data[1];
mouseX = (int8_t)data[2];
mouseY = (int8_t)data[3];
if (length >= 5) {
wheel = (int8_t)data[4];
if (length >= 6) {
wheelH = (int8_t)data[5];
}
}
mouseEvent = true;

return true;
}


Loading…
取消
儲存