Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
baee0b5682 | ||
|
|
6153d54f59 | ||
|
|
0a6ebe2903 | ||
|
|
2d7cd68459 |
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to the [UHK Versioning](VERSIONING.md) conventions.
|
and this project adheres to the [UHK Versioning](VERSIONING.md) conventions.
|
||||||
|
|
||||||
|
## [8.4.1] - 2018-07-31
|
||||||
|
|
||||||
|
Device Protocol: 4.4.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
||||||
|
|
||||||
|
- Make some improvements to the sleep/wake code.
|
||||||
|
|
||||||
## [8.4.0] - 2018-07-24
|
## [8.4.0] - 2018-07-24
|
||||||
|
|
||||||
Device Protocol: 4.**4.0** | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
Device Protocol: 4.**4.0** | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
||||||
|
|||||||
Submodule lib/agent updated: ac89aff018...fa32f95438
@@ -163,23 +163,30 @@ static usb_device_class_config_list_struct_t UsbDeviceCompositeConfigList = {
|
|||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
bool IsHostSleeping = false;
|
volatile bool SleepModeActive = true;
|
||||||
|
static volatile bool wakeUpHostAllowed;
|
||||||
|
|
||||||
static void suspendHost(void) {
|
static void suspendUhk(void) {
|
||||||
IsHostSleeping = true;
|
SleepModeActive = true;
|
||||||
LedSlaveDriver_DisableLeds();
|
LedSlaveDriver_DisableLeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WakeUpHost(bool sendResume) {
|
static void wakeUpUhk(void) {
|
||||||
if (sendResume) { // The device should wake up the host.
|
SleepModeActive = false;
|
||||||
// Send resume signal - this will call USB_DeviceKhciControl(khciHandle, kUSB_DeviceControlResume, NULL);
|
|
||||||
USB_DeviceSetStatus(UsbCompositeDevice.deviceHandle, kUSB_DeviceStatusBus, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
IsHostSleeping = false;
|
|
||||||
LedSlaveDriver_UpdateLeds();
|
LedSlaveDriver_UpdateLeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WakeUpHost(void) {
|
||||||
|
if (!wakeUpHostAllowed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Send resume signal - this will call USB_DeviceKhciControl(khciHandle, kUSB_DeviceControlResume, NULL);
|
||||||
|
USB_DeviceSetStatus(UsbCompositeDevice.deviceHandle, kUSB_DeviceStatusBus, NULL);
|
||||||
|
while (SleepModeActive) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event, void *param)
|
static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event, void *param)
|
||||||
{
|
{
|
||||||
usb_status_t status = kStatus_USB_Error;
|
usb_status_t status = kStatus_USB_Error;
|
||||||
@@ -190,10 +197,6 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsHostSleeping) {
|
|
||||||
WakeUpHost(false); // Wake up the keyboard if there is any activity on the bus.
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case kUSB_DeviceEventBusReset:
|
case kUSB_DeviceEventBusReset:
|
||||||
UsbCompositeDevice.attach = 0;
|
UsbCompositeDevice.attach = 0;
|
||||||
@@ -201,17 +204,17 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event,
|
|||||||
break;
|
break;
|
||||||
case kUSB_DeviceEventSuspend:
|
case kUSB_DeviceEventSuspend:
|
||||||
if (UsbCompositeDevice.attach) {
|
if (UsbCompositeDevice.attach) {
|
||||||
suspendHost(); // The host sends this event when it goes to sleep, so turn off all the LEDs.
|
suspendUhk(); // The host sends this event when it goes to sleep, so turn off all the LEDs.
|
||||||
status = kStatus_USB_Success;
|
status = kStatus_USB_Success;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kUSB_DeviceEventResume:
|
case kUSB_DeviceEventResume:
|
||||||
// We will just wake up the host if there is any activity on the bus.
|
wakeUpUhk();
|
||||||
// The problem is that the host won't send a resume event when it boots, so the lights will never come back on.
|
|
||||||
status = kStatus_USB_Success;
|
status = kStatus_USB_Success;
|
||||||
break;
|
break;
|
||||||
case kUSB_DeviceEventSetConfiguration:
|
case kUSB_DeviceEventSetConfiguration:
|
||||||
UsbCompositeDevice.attach = 1;
|
UsbCompositeDevice.attach = 1;
|
||||||
|
wakeUpUhk();
|
||||||
UsbCompositeDevice.currentConfiguration = *temp8;
|
UsbCompositeDevice.currentConfiguration = *temp8;
|
||||||
UsbGenericHidSetConfiguration(UsbCompositeDevice.genericHidHandle, *temp8);
|
UsbGenericHidSetConfiguration(UsbCompositeDevice.genericHidHandle, *temp8);
|
||||||
UsbBasicKeyboardSetConfiguration(UsbCompositeDevice.basicKeyboardHandle, *temp8);
|
UsbBasicKeyboardSetConfiguration(UsbCompositeDevice.basicKeyboardHandle, *temp8);
|
||||||
@@ -266,6 +269,10 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event,
|
|||||||
case kUSB_DeviceEventGetHidPhysicalDescriptor:
|
case kUSB_DeviceEventGetHidPhysicalDescriptor:
|
||||||
status = USB_DeviceGetHidPhysicalDescriptor(handle, (usb_device_get_hid_physical_descriptor_struct_t *)param);
|
status = USB_DeviceGetHidPhysicalDescriptor(handle, (usb_device_get_hid_physical_descriptor_struct_t *)param);
|
||||||
break;
|
break;
|
||||||
|
case kUSB_DeviceEventSetRemoteWakeup:
|
||||||
|
wakeUpHostAllowed = *temp8;
|
||||||
|
status = kStatus_USB_Success;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
@@ -28,12 +28,12 @@
|
|||||||
|
|
||||||
// Variables:
|
// Variables:
|
||||||
|
|
||||||
extern bool IsHostSleeping;
|
extern volatile bool SleepModeActive;
|
||||||
extern usb_composite_device_t UsbCompositeDevice;
|
extern usb_composite_device_t UsbCompositeDevice;
|
||||||
|
|
||||||
//Functions:
|
//Functions:
|
||||||
|
|
||||||
void InitUsb(void);
|
void InitUsb(void);
|
||||||
void WakeUpHost(bool sendResume);
|
void WakeUpHost(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -425,11 +425,11 @@ void UpdateUsbReports(void)
|
|||||||
KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId];
|
KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsHostSleeping) {
|
if (SleepModeActive) {
|
||||||
for (uint8_t slotId = 0; slotId < SLOT_COUNT; slotId++) {
|
for (uint8_t slotId = 0; slotId < SLOT_COUNT; slotId++) {
|
||||||
for (uint8_t keyId = 0; keyId < MAX_KEY_COUNT_PER_MODULE; keyId++) {
|
for (uint8_t keyId = 0; keyId < MAX_KEY_COUNT_PER_MODULE; keyId++) {
|
||||||
if (KeyStates[slotId][keyId].current) {
|
if (KeyStates[slotId][keyId].current) {
|
||||||
WakeUpHost(true);
|
WakeUpHost();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -455,10 +455,6 @@ void UpdateUsbReports(void)
|
|||||||
bool HasUsbSystemKeyboardReportChanged = memcmp(ActiveUsbSystemKeyboardReport, GetInactiveUsbSystemKeyboardReport(), sizeof(usb_system_keyboard_report_t)) != 0;
|
bool HasUsbSystemKeyboardReportChanged = memcmp(ActiveUsbSystemKeyboardReport, GetInactiveUsbSystemKeyboardReport(), sizeof(usb_system_keyboard_report_t)) != 0;
|
||||||
bool HasUsbMouseReportChanged = memcmp(ActiveUsbMouseReport, GetInactiveUsbMouseReport(), sizeof(usb_mouse_report_t)) != 0;
|
bool HasUsbMouseReportChanged = memcmp(ActiveUsbMouseReport, GetInactiveUsbMouseReport(), sizeof(usb_mouse_report_t)) != 0;
|
||||||
|
|
||||||
if (IsHostSleeping && (previousLayer != LayerId_Base || HasUsbBasicKeyboardReportChanged || HasUsbMediaKeyboardReportChanged || HasUsbSystemKeyboardReportChanged || HasUsbMouseReportChanged)) {
|
|
||||||
WakeUpHost(true); // Wake up the host if any key is pressed and the computer is sleeping.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasUsbBasicKeyboardReportChanged) {
|
if (HasUsbBasicKeyboardReportChanged) {
|
||||||
usb_status_t status = UsbBasicKeyboardAction();
|
usb_status_t status = UsbBasicKeyboardAction();
|
||||||
if (status == kStatus_USB_Success) {
|
if (status == kStatus_USB_Success) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"commander": "^2.11.0",
|
"commander": "^2.11.0",
|
||||||
"shelljs": "^0.7.8"
|
"shelljs": "^0.7.8"
|
||||||
},
|
},
|
||||||
"firmwareVersion": "8.4.0",
|
"firmwareVersion": "8.4.1",
|
||||||
"deviceProtocolVersion": "4.4.0",
|
"deviceProtocolVersion": "4.4.0",
|
||||||
"moduleProtocolVersion": "4.0.0",
|
"moduleProtocolVersion": "4.0.0",
|
||||||
"userConfigVersion": "4.1.0",
|
"userConfigVersion": "4.1.0",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#define FIRMWARE_MAJOR_VERSION 8
|
#define FIRMWARE_MAJOR_VERSION 8
|
||||||
#define FIRMWARE_MINOR_VERSION 4
|
#define FIRMWARE_MINOR_VERSION 4
|
||||||
#define FIRMWARE_PATCH_VERSION 0
|
#define FIRMWARE_PATCH_VERSION 1
|
||||||
|
|
||||||
#define DEVICE_PROTOCOL_MAJOR_VERSION 4
|
#define DEVICE_PROTOCOL_MAJOR_VERSION 4
|
||||||
#define DEVICE_PROTOCOL_MINOR_VERSION 4
|
#define DEVICE_PROTOCOL_MINOR_VERSION 4
|
||||||
|
|||||||
Reference in New Issue
Block a user