diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h index 70e09e2e..001df708 100644 --- a/converter/adb_usb/config.h +++ b/converter/adb_usb/config.h @@ -56,7 +56,7 @@ along with this program. If not, see . #define ADB_PIN PIND #define ADB_DDR DDRD #define ADB_DATA_BIT 0 -//#define ADB_PSW_BIT 1 // optional +#define ADB_PSW_BIT 1 /* key combination for command */ #ifndef __ASSEMBLER__ diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c index f6fecfd2..d7c600f2 100644 --- a/converter/adb_usb/matrix.c +++ b/converter/adb_usb/matrix.c @@ -621,6 +621,22 @@ uint8_t matrix_scan(void) if (!codes && adb_service_request()) codes = adb_host_kbd_recv(ADB_ADDR_KEYBOARD); if (codes) xprintf("%04X ", codes); + // Check PSW pin + static bool psw_state = false; + if (codes == 0) { + if (!psw_state) { + if (!adb_host_psw()) { + codes = 0x7F7F; // power key press + psw_state = true; + } + } else { + if (adb_host_psw()) { + codes = 0xFFFF; // power key release + psw_state = false; + } + } + } + // Adjustable keybaord media keys if (codes == 0 && has_media_keys && (codes = adb_host_kbd_recv(ADB_ADDR_APPLIANCE))) {