Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions right/src/macros/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,10 @@ static macro_result_t processSwitchHostCommand(parser_context_t* ctx)
return MacroResult_Finished;
}

void ReportScrolls(void) {
Macros_ReportPrintf(NULL, "Scroll multipliers %d %d", (int)(VerticalScrollMultiplier()), (int)(HorizontalScrollMultiplier()));
}

static macro_result_t processCommand(parser_context_t* ctx)
{
if (*ctx->at == '$') {
Expand Down Expand Up @@ -2295,6 +2299,11 @@ static macro_result_t processCommand(parser_context_t* ctx)
else if (ConsumeToken(ctx, "statsRuntime")) {
return Macros_ProcessStatsRuntimeCommand();
}
else if (ConsumeToken(ctx, "statsScroll")) {
ReportScrolls();

return MacroResult_Finished;
}
else if (ConsumeToken(ctx, "statsRecordKeyTiming")) {
return Macros_ProcessStatsRecordKeyTimingCommand();
}
Expand Down
3 changes: 3 additions & 0 deletions right/src/usb_composite_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,21 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event,
break;
case kUSB_DeviceEventSuspend:
if (UsbCompositeDevice.attach) {
Macros_ReportPrintf(NULL, "USB suspended");
PowerMode_ActivateMode(PowerMode_Uhk60Sleep, false);
status = kStatus_USB_Success;
}
break;
case kUSB_DeviceEventResume:
Macros_ReportPrintf(NULL, "USB resumed");
PowerMode_ActivateMode(PowerMode_Awake, false);
status = kStatus_USB_Success;
break;
case kUSB_DeviceEventSetConfiguration: {
uint8_t interface;
UsbCompositeDevice.attach = 1;
PowerMode_ActivateMode(PowerMode_Awake, false);
Macros_ReportPrintf(NULL, "Awake -> set configuration");
for (interface = 0; interface < USB_DEVICE_CONFIG_HID; ++interface) {
usb_device_class_config_struct_t *intf = &UsbDeviceCompositeConfigList.config[interface];

Expand Down
4 changes: 4 additions & 0 deletions right/src/usb_interfaces/usb_interface_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <string.h>
#include "event_scheduler.h"
#include "attributes.h"
#include "macros/status_buffer.h"

#ifdef __ZEPHYR__
#include "usb/usb_compatibility.h"
Expand Down Expand Up @@ -78,6 +79,7 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param

switch (event) {
case ((uint32_t)-kUSB_DeviceEventSetConfiguration):
Macros_ReportPrintf(NULL, "USB Mouse: Set Configuration -> 0");
usbMouseFeatBuffer[0] = 0;
error = kStatus_USB_Success;
break;
Expand Down Expand Up @@ -138,6 +140,8 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param
// all; but it only sends this report when it detects the
// resolution multiplier, and the intention is to activate the
// feature, so turn high-res mode on here.

Macros_ReportPrintf(NULL, "USB Mouse: Request Report Buffer -> 1");
report->reportBuffer = usbMouseFeatBuffer;
usbMouseFeatBuffer[0] = 0x1;
error = kStatus_USB_Success;
Expand Down
1 change: 1 addition & 0 deletions right/src/usb_interfaces/usb_interface_mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
usb_hid_protocol_t UsbMouseGetProtocol(void);
#endif

void ReportScrolls(void);
float VerticalScrollMultiplier(void);
float HorizontalScrollMultiplier(void);
void UsbMouseResetActiveReport(void);
Expand Down