Bugfixes and improvements:

==========================

Added 1000 Hz polling.
(Hopefully) fixed Logitech mouse issues
Removed special treatment for 12 and 16-bit mice
Increased mouse queue size
Increased current allowance from 100mA to 500mA
Allow mouse to wake up a suspended host
Added memory usage print to build

Updated README
  - Added link to troubleshooting wiki
  - Mouse polling rate chart
  - Updated known issues
  - Updates about possible PCB/assembly ordering
This commit is contained in:
Hrvoje Cavrak 2024-01-11 17:57:29 +01:00
parent 73a83b72e3
commit de3cb4dba7
7 changed files with 38 additions and 29 deletions

View File

@ -86,3 +86,13 @@ target_link_libraries(board_B PUBLIC ${COMMON_LINK_LIBRARIES})
pico_enable_stdio_usb(board_B 0)
pico_add_extra_outputs(board_B)
target_link_options(board_A PRIVATE
-Xlinker
--print-memory-usage
)
target_link_options(board_B PRIVATE
-Xlinker
--print-memory-usage
)

View File

@ -140,8 +140,7 @@ USB-A connector can be Molex MX-67643-0910 or a cheaper/budget one that shares t
Additional steps:
- making the PCB ([Gerber provided](pcb/), JLC does it for a few bucks, choose 1.6 mm thickness)
- making the PCB ([Gerber provided](pcb/), choose 1.6 mm thickness)
- 3d printing the case ([stl files provided](case/), ~33g filament)
## Assembly guide
@ -166,6 +165,10 @@ The standard process to do that is using isopropyl alcohol and an old toothbrush
*I'm not selling anything, this is just a personal, non-commercial hobby project.*
[update] There is a manufacturing/assembly company in China that might offer PCBs in qty of 1, assembled boards and boards + case, so stay tuned.
I **don't want to take any commission** on this - the only goal is to provide an alternative for people who don't feel confident enough to assemble the boards themselves.
4. When the active screen is changed via the mouse, does the keyboard follow (and vice versa)?
Yes, the idea was to make it behave like it was one single computer.
@ -178,6 +181,10 @@ Not with the current version, but there is work ongoing to add support. Testing
It should work - tried an Anker wireless mouse with a separate receiver and that worked just fine.
7. I have issues with build or compilation
Check out the [Troubleshooting Wiki](https://github.com/hrvach/deskhop/wiki/Troubleshooting) that might have some answers.
## Software Alternatives
There are several software alternatives you can use if that works in your particular situation.
@ -190,7 +197,9 @@ There are several software alternatives you can use if that works in your partic
## Shortcomings
- Slow mouse movement reported for modern mice with 16-bit x/y values. Can't reproduce with my 2$ mouse, ordered a better one so once it arrives, I'll hopefully be able to recreate and fix. Apologies and thanks for understanding!
- Slow mouse movement with some devices.
- Windows 10 broke HID absolute coordinates behavior in KB5003637, so you can't use more than 1 screen on Windows (mouse will stay on the main screen).
- If you have more than one display, the mouse is faster in the X direction on that machine. Will get fixed with per-output configurable speed settings.
- Code needs cleanup, some refactoring etc.
- Occasional bugs and weird behavior.
- Not tested with a wide variety of devices, I don't know how it will work with your hardware. There is a reasonable chance things might not work out-of-the-box.
@ -210,6 +219,10 @@ Planned features:
- Unified firmware for both Picos
- ... and more!
Mouse polling should now work at 1000 Hz (the dips in the graph is my arm hurting from all the movement :-)):
![Mouse polling rate](img/polling_rate.png)
## Disclaimer
I kindly request that anyone attempting to build this project understands and acknowledges that I am not liable for any injuries, damages, or other consequences. Your safety is important, and I encourage you to approach this project carefully, taking necessary precautions and assuming personal responsibility for your well-being throughout the process. Please don't get electrocuted, burned, stressed or angry. Have fun and enjoy!

BIN
img/polling_rate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -124,7 +124,7 @@ typedef struct {
#define RAW_PACKET_LENGTH (START_LENGTH + PACKET_LENGTH)
#define KBD_QUEUE_LENGTH 128
#define MOUSE_QUEUE_LENGTH 256
#define MOUSE_QUEUE_LENGTH 2048
#define KEYS_IN_USB_REPORT 6
#define KBD_REPORT_LENGTH 8

View File

@ -96,30 +96,12 @@ void extract_values_report_protocol(uint8_t* report,
values->move_y = get_report_value(report, &state->mouse_dev.move_y);
values->wheel = get_report_value(report, &state->mouse_dev.wheel);
values->buttons = get_report_value(report, &state->mouse_dev.buttons);
/* Mice generally come in 3 categories - 8-bit, 12-bit and 16-bit. */
switch (state->mouse_dev.move_x.size) {
case 12:
/* If we're already 12 bit, great! */
break;
case 16:
/* Initially we downscale fancy mice to 12-bits,
adding a 32-bit internal coordinate tracking is TODO */
values->move_x >>= 4;
values->move_y >>= 4;
break;
default:
/* 8-bit is the default, upscale to 12-bit. */
values->move_x <<= 4;
values->move_y <<= 4;
}
}
void extract_values_boot_protocol(uint8_t* report, device_state_t* state, mouse_values_t* values) {
hid_mouse_report_t* mouse_report = (hid_mouse_report_t*)report;
/* For 8-bit values, we upscale them to 12-bit, TODO: 16 bit */
values->move_x = mouse_report->x << 4;
values->move_y = mouse_report->y << 4;
values->move_x = mouse_report->x;
values->move_y = mouse_report->y;
values->wheel = mouse_report->wheel;
values->buttons = mouse_report->buttons;
}
@ -171,6 +153,10 @@ void process_mouse_queue_task(device_state_t* state) {
if (!queue_try_peek(&state->mouse_queue, &report))
return;
/* If we are suspended, let's wake the host up */
if(tud_suspended())
tud_remote_wakeup();
/* ... try sending it to the host, if it's successful */
bool succeeded = tud_hid_abs_mouse_report(REPORT_ID_MOUSE, report.buttons, report.x, report.y,
report.wheel, report.pan);

View File

@ -107,7 +107,7 @@ uint8_t const desc_configuration[] = {
0,
CONFIG_TOTAL_LEN,
TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP,
100),
500),
// Interface number, string index, protocol, report descriptor len, EP In address, size &
// polling interval
@ -117,7 +117,7 @@ uint8_t const desc_configuration[] = {
sizeof(desc_hid_report),
EPNUM_HID,
CFG_TUD_HID_EP_BUFSIZE,
5)};
1)};
#if TUD_OPT_HIGH_SPEED
// Per USB specs: high speed capable device must report device_qualifier and

View File

@ -44,7 +44,7 @@
*
* */
#define MOUSE_SPEED_FACTOR_X 1
#define MOUSE_SPEED_FACTOR_Y 1
#define MOUSE_SPEED_FACTOR_X 16
#define MOUSE_SPEED_FACTOR_Y 16
#define MOUSE_JUMP_THRESHOLD 0