### help() — GET Source: https://www.makcu.com/en/api Show command list. ```APIDOC ## help() — GET ### Description Show command list. ### Response (GET) ``` km.help() >>> ``` ``` -------------------------------- ### Get System Information Source: https://www.makcu.com/en/api Retrieves system information including MAC address, MCU temperature, RAM stats, firmware, CPU, and uptime. This is a GET request. ```python km.info() >>> ``` -------------------------------- ### Get Command List Source: https://www.makcu.com/en/api Retrieves a list of available commands. This is a GET request. ```python km.help() >>> ``` -------------------------------- ### info() — GET Source: https://www.makcu.com/en/api Report system info: MAC address, MCU temperature, RAM stats, firmware info, CPU, and uptime. ```APIDOC ## info() — GET ### Description Report system info: MAC address, MCU temperature (when available), RAM stats, firmware info, CPU, and uptime. ### Response (GET) ``` km.info() >>> ``` ``` -------------------------------- ### version() — GET (0xBF) Source: https://www.makcu.com/en/api Retrieves the firmware version information as ASCII bytes. ```APIDOC ## version() — GET (0xBF) ### Description Get firmware version information. ### Params No parameters ### Response (GET) - **Response**: `[0xBF] [version:u8×N]` ### Data Format Returns firmware version as ASCII bytes. ``` -------------------------------- ### version() — GET Source: https://www.makcu.com/en/api Report firmware version. ```APIDOC ## version() — GET ### Description Report firmware version. ### Response (GET) ``` km.version() >>> ``` ``` -------------------------------- ### info() — GET (0xB8) Source: https://www.makcu.com/en/api Fetches system and device information in a key-value format. Includes details like MAC addresses, temperature, RAM usage, firmware version, CPU load, uptime, vendor/product IDs, and serial numbers. Device info is cached after the first fetch. ```APIDOC ## info() — GET (0xB8) ### Description System/device info - key=value format: MAC1, MAC2, TEMP, RAM, FW, CPU, UP, VID, PID, VENDOR, MODEL, ORIGINAL_SERIAL, SPOOFED_SERIAL, MOUSE_BINT, KBD_BINT, FAULT. ### Params No parameters ### Response (GET) - **Response**: `[0xB8] [field_count:u8] [fields...]` ### Data Format Returns structured binary data with system/device info key-value pairs. Device info cached after first fetch. ``` -------------------------------- ### Get Device Usage Source: https://www.makcu.com/en/api Reports which device (keyboard, mouse, or none) is being used most. This is a GET request. ```python km.device() >>> ``` -------------------------------- ### Get Firmware Version Source: https://www.makcu.com/en/api Retrieves the firmware version of the device. This is a GET request. ```python km.version() >>> ``` -------------------------------- ### device() — GET Source: https://www.makcu.com/en/api Report which device is used more: (keyboard), (mouse), or (none). ```APIDOC ## device() — GET ### Description Report which device is used more: (keyboard), (mouse), or (none). ### Response (GET) ``` km.device() >>> ``` ``` -------------------------------- ### Flash Device LED Source: https://www.makcu.com/en/api Use `km.led(1, times, delay_ms)` to flash the device LED a specified number of times with a given delay between flashes. For example, `km.led(1, 3, 200)` will flash the LED 3 times with a 200ms delay. ```python km.led(1, 3, 200) >>> ``` -------------------------------- ### screen([W,H]) — GET/SET (0xBD) Source: https://www.makcu.com/en/api Sets or gets the virtual screen dimensions. Accepts width and height as signed 16-bit integers. ```APIDOC ## screen([W,H]) — GET/SET (0xBD) ### Description Set/get virtual screen dimensions. ### Params - `() to query` - `(width,height) set virtual screen size (int16)` ### Response (GET) - **Response**: `[0xBD] [width:i16] [height:i16]` ### Response (SET) - **Request**: `[0xBD] [width:i16] [height:i16]` - **Response**: `[0xBD] [status:u8]` ### Status Codes - `0x00 (OK)` on success - `0x01 (ERR)` on error ``` -------------------------------- ### V2 API (Binary) Frame Format Source: https://www.makcu.com/en/api Details the frame structure for the V2 Binary API, including RX and TX formats, data types, and command examples. ```APIDOC ## V2 API (Binary) All binary commands use the same frame structure. The frame format is explained below, and subsequent command examples show only the command byte and payload data. ### RX (Host → Device) - **Frame format:** `[0x50] [CMD] [LEN_LO] [LEN_HI] [PAYLOAD...]` - `0x50` - Frame start byte (fixed) - `CMD` - Command byte (0x01-0xFF) - `LEN_LO` / `LEN_HI` - Payload length in bytes (little-endian, 16-bit) - `PAYLOAD` - Command-specific data (variable length) ### TX (Device → Host) - **Setters** : Return `[0x50] [CMD] [LEN_LO] [LEN_HI] [status:u8]` where 0x00 = OK (success) and 0x01 = ERR (error) - **Getters** : Return `[0x50] [CMD] [LEN_LO] [LEN_HI] [PAYLOAD...]` with raw value bytes or structured data - **Streaming** : Return raw HID frame bytes (no text formatting) as `[0x50] [CMD] [LEN_LO] [LEN_HI] [PAYLOAD...]` - **Data Types** : Multi-byte values use little-endian byte order. Example: Query baud rate (command 0xB1, no payload) returns `[0x50] [0xB1] [0x04] [0x00] [0x00] [0xC2] [0x01] [0x00]` where `0x00C20100` = 115200 (little-endian) - In subsequent command examples, we show only: `[CMD] [PAYLOAD...]` ``` -------------------------------- ### device() — GET (0xB3) Source: https://www.makcu.com/en/api Retrieves the active device type. Possible types include none, keyboard, and mouse. ```APIDOC ## device() — GET (0xB3) ### Description Returns active device type. ### Params No parameters ### Response (GET) - **Response**: `[0xB3] [type:u8]` ### Device Types - `0=none` - `1=keyboard` - `2=mouse` ``` -------------------------------- ### Query Baud Rate Source: https://www.makcu.com/en/api Queries the current baud rate. This is a GET request. ```python km.baud(115200) >>> ``` -------------------------------- ### Set Virtual Screen Size Source: https://www.makcu.com/en/api Use `km.screen(width, height)` to set the virtual screen size. For example, `km.screen(2560, 1440)` sets the resolution to 2560x1440. ```python km.screen(2560,1440) >>> ``` -------------------------------- ### Set Baud Rate (Legacy Binary Frame) Source: https://www.makcu.com/en/api This example shows the binary frame structure for setting the UART baud rate to 115200. It includes the frame header, length, command, and baud rate payload in little-endian format. ```hex DE AD 05 00 A5 00 C2 01 00 ``` -------------------------------- ### Get Auto-Release Timer Status Source: https://www.makcu.com/en/api Call `km.release()` without arguments to retrieve the current status of the auto-release monitoring system. A return value of 0 indicates it is disabled. ```python km.release() >>> ``` -------------------------------- ### baud([rate]) Source: https://www.makcu.com/en/api Set or get the UART0 baud rate. The default baud rate is 115200. The rate can be set to a value between 115200 and 4000000. ```APIDOC ## baud([rate]) — GET/SET (0xB1) ### Description Set/get UART0 baud rate - 0=default (115200) ### Params () to query; (rate) set baud rate (u32), 0=default 115200, range: 115200-4000000 ### Response (GET) ``` [0xB1] Response: [0xB1] [rate:u32] ``` Returns current baud rate as uint32 (little-endian). ### Response (SET) ``` [0xB1] [rate:u32] Response: [0xB1] [status:u8] ``` Returns 0x00 (OK) on success, 0x01 (ERR) on error. Change is persistent. ``` -------------------------------- ### Set Auto-Release Timer Source: https://www.makcu.com/en/api Use `km.release(timer_ms)` to set the auto-release timer. The `timer_ms` parameter specifies the duration in milliseconds. For example, `km.release(5000)` sets the timer to 5 seconds. ```python km.release(5000) >>> ``` -------------------------------- ### fault() — GET (0xB5) Source: https://www.makcu.com/en/api Retrieves stored parse fault information. This is equivalent to command 0xE8 and returns a structure containing MAC, endpoint, reason, and raw descriptor bytes. ```APIDOC ## fault() — GET (0xB5) ### Description Get stored parse fault info (same as 0xE8). ### Params No parameters ### Response (GET) - **Response**: `[0xB5] [parse_fault_t struct]` ### Returned Data Returns `parse_fault_t` structure with MAC, endpoint, reason, and raw descriptor bytes. ``` -------------------------------- ### fault() — GET Source: https://www.makcu.com/en/api Returns stored parse fault information including ESP32 MAC address, failed endpoint address, interface number, failure reason, and raw HID descriptor bytes. Useful for debugging devices that fail to parse. ```APIDOC ## fault() — GET ### Description Returns stored parse fault information including ESP32 MAC address, failed endpoint address, interface number, failure reason, and raw HID descriptor bytes. Useful for debugging devices that fail to parse. ### Response (GET) ``` km.fault() >>> ``` ``` -------------------------------- ### init() Source: https://www.makcu.com/en/api Clears the keyboard state and releases any currently pressed keys. ```APIDOC ## init() — SET ### Description Clears keyboard state and releases pressed keys. ### Request Example ``` km.init() ``` ``` -------------------------------- ### Get Serial Number Source: https://www.makcu.com/en/api Queries the current serial number of an attached mouse or keyboard. This is a GET request. ```python km.serial() >>> km.serial("MAKCU001") >>> ``` -------------------------------- ### Turn On Host LED Source: https://www.makcu.com/en/api Use `km.led(2, 1)` to turn on the host LED via UART. This command is used for controlling the USB host side LED. ```python km.led(2, 1) >>> ``` -------------------------------- ### Flash Host LED Source: https://www.makcu.com/en/api Use `km.led(2, times, delay_ms)` to flash the host LED. This allows for visual indication on the USB host side. For instance, `km.led(2, 5, 100)` flashes the host LED 5 times with 100ms delays. ```python km.led(2, 5, 100) >>> ``` -------------------------------- ### Get Fault Information Source: https://www.makcu.com/en/api Retrieves stored parse fault information, including MAC address, failed endpoint, interface number, reason, and raw HID descriptor bytes. Useful for debugging. This is a GET request. ```python km.fault() >>> ``` -------------------------------- ### Press System Navigation Keys Source: https://www.makcu.com/en/api Simulate pressing system navigation keys such as Home, End, Page Up, Page Down, and arrow keys using their string names. ```python km.press('home') # Home key (HID 74) ``` -------------------------------- ### Simulate Key Release (Up) Source: https://www.makcu.com/en/api Simulates a key release (key up event). The key can be specified by its numeric HID code or a string key name. ```APIDOC ## up(key) — SET ### Description Simulate key release (up event). ### Params key: HID code or quoted string ('a', "ctrl") ### Response Example ```python km.up("ctrl") ``` ``` -------------------------------- ### Get Mouse Position Source: https://www.makcu.com/en/api Retrieve the current position of the mouse pointer on the screen. ```APIDOC ## Get Mouse Position (GET) ### Description Retrieve the current position of the mouse pointer on the screen. ### Command `getpos()` ### Response (GET) ``` km.getpos() >>> km.getpos(123,456) >>> ``` Returns current pointer position as (x,y). ``` -------------------------------- ### Schedule Mouse Clicks Source: https://www.makcu.com/en/api Use the binary command `[0x04] [button:u8] [count:u8] [delay_ms:u8]` to schedule mouse clicks. Specify the button (1-5), the number of clicks, and the delay in milliseconds (0 for random 35-75ms). Success is indicated by `[0x04] [0x00]`. ```binary [0x04] [button:u8] [count:u8] [delay_ms:u8] Response: [0x04] [status:u8] ``` -------------------------------- ### led([target[,mode[,times,delay_ms]]]) Source: https://www.makcu.com/en/api Control LED and RGB state for both device and host sides. Supports query, control, and flash functionality. ```APIDOC ## led([target[,mode[,times,delay_ms]]]) — GET/SET ### Description Control LED and RGB state for both device and host sides. Supports query, control, and flash functionality. ### Query - `led()` - Query device LED state (backward compatible) - `led(1)` - Query device LED state - `led(2)` - Query host LED state (via UART) - Returns: (device,off), (device,on), (device,slow_blink), (device,fast_blink), (host,off), (host,on), etc. ### Control - `led(0)` - Turn device LED off (backward compatible) - `led(1)` - Turn device LED on (backward compatible, but conflicts with query - use led(1,1) for explicit control) - `led(1, 0)` - Turn device LED off - `led(1, 1)` - Turn device LED on - `led(2, 0)` - Turn host LED off (via UART) - `led(2, 1)` - Turn host LED on (via UART) - **Target:** 1 = device LED, 2 = host LED (USB host side, controlled via UART) - **Mode:** 0 = off, 1 = on ### Flash - `led(1, times, delay_ms)` - Flash device LED (e.g., led(1, 3, 200) = 3 flashes at 200ms) - `led(2, times, delay_ms)` - Flash host LED (e.g., led(2, 5, 100) = 5 flashes at 100ms) - **Flash parameters:** times = number of flashes (default 1), delay_ms = delay between flashes in milliseconds (default 100ms, max 5000ms) ### Examples ``` km.led() >>> km.led(device,on) >>> ``` ``` km.led(2) >>> km.led(host,off) >>> ``` ``` km.led(1, 0) >>> ``` ``` km.led(2, 1) >>> ``` ``` km.led(1, 3, 200) >>> ``` ``` km.led(2, 5, 100) >>> ``` ``` -------------------------------- ### Get Current Mouse Position Source: https://www.makcu.com/en/api Retrieves the current X and Y coordinates of the mouse pointer. ```text [0x05] Response: [0x05] [x:i16] [y:i16] ``` -------------------------------- ### Query Device LED State Source: https://www.makcu.com/en/api Use `km.led()` to query the current state of the device LED. This is a backward-compatible method. ```python km.led() >>> km.led(device,on) >>> ``` -------------------------------- ### reboot() — SET (0xBB) Source: https://www.makcu.com/en/api Initiates a device reboot. The device will reboot after sending the success response. ```APIDOC ## reboot() — SET (0xBB) ### Description Reboot device after response. ### Params No parameters ### Response (SET) - **Response**: `[0xBB] [status:u8]` ### Status Codes Always returns `0x00 (success)`. Device reboots after sending response. ``` -------------------------------- ### Query Bypass Mode Source: https://www.makcu.com/en/api Queries the current bypass mode state. This is a GET request. ```python km.bypass() >>> km.bypass(0) >>> ``` -------------------------------- ### Get Current Mouse Position Source: https://www.makcu.com/en/api Retrieves the current (x,y) coordinates of the mouse pointer. ```text km.getpos() >>> km.getpos(123,456) >>> ``` -------------------------------- ### Press Function Keys Source: https://www.makcu.com/en/api Simulate pressing function keys F1 through F12 using their respective string names. ```python km.press('f1') # F1 key (HID 58) ``` -------------------------------- ### Query Host LED State Source: https://www.makcu.com/en/api Use `km.led(2)` to query the state of the host LED, which is controlled via UART. This method is useful for monitoring the USB host side. ```python km.led(2) >>> km.led(host,off) >>> ``` -------------------------------- ### Simulate Keyboard Key Release (Up) Source: https://www.makcu.com/en/api Simulates releasing a keyboard key. The key can be specified by its numeric HID code or as a quoted string (e.g., 'a', 'ctrl'). ```python km.up("ctrl") ``` -------------------------------- ### Get Mouse Button State Source: https://www.makcu.com/en/api Retrieves the current lock state of the mouse's left button. Response indicates none, raw, injected, or both lock states. ```text km.left() >>> ``` -------------------------------- ### Query Virtual Screen Size Source: https://www.makcu.com/en/api Use `km.screen()` without arguments to query the current virtual screen dimensions (width and height). ```python km.screen(1920,1080) >>> ``` -------------------------------- ### Press Control Keys Source: https://www.makcu.com/en/api Simulate pressing common control keys like Enter, Escape, Backspace, Tab, and Spacebar using their string names. ```python km.press('enter') # Enter key (HID 40) ``` -------------------------------- ### Press Numpad Keys Source: https://www.makcu.com/en/api Simulate pressing keys on the numeric keypad, including numbers, operators, and the Enter key, using their string names. ```python km.press('kp1') # Numpad 1 (HID 89) ``` -------------------------------- ### screen([width,height]) Source: https://www.makcu.com/en/api Set virtual screen size. Can be used to query the current size or set a new one. ```APIDOC ## screen([width,height]) — GET/SET ### Description Set virtual screen size. Can be used to query the current size or set a new one. ### Params - `()` to query - `(width,height)` to set virtual screen size ### Response (GET) ``` km.screen(1920,1080) >>> ``` ### Response (SET) ``` km.screen(2560,1440) >>> ``` ``` -------------------------------- ### echo([enable]) — GET/SET Source: https://www.makcu.com/en/api Enable or disable echo mode. Query with empty parentheses, enable with (1), disable with (0). ```APIDOC ## echo([enable]) — GET/SET ### Description Enable or disable echo mode. Query with empty parentheses, enable with (1), disable with (0). ### Parameters - **enable** (int) - Optional - 1=on, 0=off. ### Response ``` km.echo(1) >>> ``` ``` -------------------------------- ### reboot() — SET Source: https://www.makcu.com/en/api Reboot device (reboots after response). ```APIDOC ## reboot() — SET ### Description Reboot device (reboots after response). ### Response (SET) ``` km.reboot() >>> ``` ``` -------------------------------- ### hs([enable]) — GET/SET Source: https://www.makcu.com/en/api Enable or disable USB high-speed compatibility. Query with empty parentheses, enable with (1), disable with (0). This setting is persistent. ```APIDOC ## hs([enable]) — GET/SET ### Description USB high-speed compatibility for devices that may not report poll rate correctly. This setting is persistent. ### Parameters - **enable** (int) - Optional - 1=enable, 0=disable. ### Response ``` km.hs(1) >>> ``` ``` -------------------------------- ### keyboard([mode[,period_ms]]) Source: https://www.makcu.com/en/api Stream keyboard data. Can be used to query the current mode and period, or to set the mode and period for keyboard data streaming. Mode can be raw (1) or muted (2). Period is in milliseconds (1-1000ms). Requires baud rate of 1M or higher. Only emits on new frames. ```APIDOC ## keyboard([mode[,period_ms]]) — GET/SET (0xA5) ### Description Stream keyboard - mode: 1=raw 2=mut; period: 1-1000ms (rounded to bInterval); requires baud >= 1M; only emits on new frames ### Params () to query; (mode) set mode; (mode,period_ms) set mode and period. mode: 1=raw 2=mut; period: 1-1000ms ### Response (GET) ``` [0xA5] Response: [0xA5] [mode:u8] [period:u8] ``` ### Response (SET) ``` [0xA5] [mode:u8] [period:u8] Response: [0xA5] [status:u8] ``` Returns 0x00 (OK) on success, 0x01 (ERR) on error. ### Streaming format Device emits 15-byte binary frame when keyboard data changes: ``` [0xA5] [modifiers:u8] [keys:u8×14] ``` Modifiers byte: bit flags for ctrl, shift, alt, gui, etc. Keys array: up to 14 HID codes. ``` -------------------------------- ### log([level]) — GET/SET (0xBA) Source: https://www.makcu.com/en/api Manages the device's log level. Allows setting a log level from 0 (none) to 5 (debug). The setting persists for 3 power cycles before automatically disabling. ```APIDOC ## log([level]) — GET/SET (0xBA) ### Description Set/get log level - 0-5. Setting persists for 3 power cycles, then disables automatically. ### Params - `() to query` - `(level) set log level. level: 0-5 (0=none, 5=debug)` ### Response (GET) - **Response**: `[0xBA] [level:u8]` ### Response (SET) - **Request**: `[0xBA] [level:u8]` - **Response**: `[0xBA] [status:u8]` ### Status Codes - `0x00 (OK)` on success - `0x01 (ERR)` on error ``` -------------------------------- ### press(key[,hold_ms[,rand_ms]]) Source: https://www.makcu.com/en/api Simulates pressing a key. You can specify a hold duration and randomization for the press. ```APIDOC ## press(key[,hold_ms[,rand_ms]]) — SET ### Description Simulates pressing a key with optional hold duration and randomization. ### Parameters #### Path Parameters - **key** (HID code or quoted key name) - Required - The key to press. - **hold_ms** (integer) - Optional - Hold duration in milliseconds. Defaults to random 35-75ms. - **rand_ms** (integer) - Optional - Randomization range added to hold_ms. 0 means no randomization. ### Request Example ``` km.press('a') ``` ``` km.press('d', 50) ``` ``` km.press('d', 50, 10) ``` ``` -------------------------------- ### Query Left Mouse Button State Source: https://www.makcu.com/en/api Use the binary command `[0x08]` to query the state of the left mouse button. The response will indicate the lock state (none, raw, injected, or both). ```binary [0x08] Response: [0x08] [state:u8] ``` -------------------------------- ### led([...]) — GET/SET (0xB9) Source: https://www.makcu.com/en/api Controls the device's LED. Supports turning LEDs on/off, setting modes (slow/fast blink), and flashing with specified times and delays. Can target the device or host. ```APIDOC ## led([...]) — GET/SET (0xB9) ### Description LED control - target: 1=device 2=host; mode: 0=off 1=on; state: 0=off 1=on 2=slow_blink 3=fast_blink ### Params - `() query device` - `(1) query device` - `(2) query host` - `(0) device off` - `(1) device on` - `(target,mode) control` - `(target,times,delay_ms) flash` ### Response (GET) - **Query device**: `[0xB9]` - **Query host**: `[0xB9] [0x02]` - **Response**: `[0xB9] [target:u8] [state:u8]` ### Response (SET) - **Set**: `[0xB9] [target:u8] [mode:u8]` - **Response**: `[0xB9] [status:u8]` ### Flash - **Flash**: `[0xB9] [target:u8] [times:u32] [delay_ms:u32]` - **Response**: `[0xB9] [status:u8]` ### State Mapping - `0=off` - `1=on` - `2=slow_blink` - `3=fast_blink` ### Status Codes - `0x00 (OK)` on success - `0x01 (ERR)` on error ### Flash Parameters - `times`: 1-255 - `delay_ms`: 100-5000ms ``` -------------------------------- ### Set Left Mouse Button State Source: https://www.makcu.com/en/api Use the binary command `[0x08] [state:u8]` to set the state of the left mouse button (0=release, 1=down, 2=silent_release). A successful operation returns `[0x08] [0x00]`. ```binary [0x08] [state:u8] Response: [0x08] [status:u8] ``` -------------------------------- ### mouse([mode[,period_ms]]) Source: https://www.makcu.com/en/api Stream full mouse data. Can be used to query the current mode and period, or to set the mode and period for mouse data streaming. Mode can be raw (1) or muted (2). Period is in milliseconds (1-1000ms). Requires baud rate of 1M or higher. Only emits on new frames. ```APIDOC ## mouse([mode[,period_ms]]) — GET/SET (0x0C) ### Description Stream full mouse data - mode: 1=raw 2=mut; period: 1-1000ms (rounded to bInterval); requires baud >= 1M; only emits on new frames ### Params () to query; (mode) set mode; (mode,period_ms) set mode and period. mode: 1=raw 2=mut; period: 1-1000ms ### Response (GET) ``` [0x0C] Response: [0x0C] [mode:u8] [period:u8] ``` ### Response (SET) ``` [0x0C] [mode:u8] [period:u8] Response: [0x0C] [status:u8] ``` Returns 0x00 (OK) on success, 0x01 (ERR) on error. ### Streaming format Device emits 8-byte binary frame when mouse data changes: ``` [0x0C] [buttons:u8] [dx:i16] [dy:i16] [wheel:i8] [pan:i8] [tilt:i8] ``` ``` -------------------------------- ### log([level]) — GET/SET Source: https://www.makcu.com/en/api Set or query the logging level. Levels range from 0-5. Setting persists for 3 power cycles. ```APIDOC ## log([level]) — GET/SET ### Description Set or query the logging level. Levels range from 0-5. Setting persists for 3 power cycles, then disables automatically. ### Parameters - **level** (int) - Optional - 0-5. Empty to query current level. ### Response ``` km.log(3) >>> ``` ``` -------------------------------- ### Stream Keyboard Input (Raw) Source: https://www.makcu.com/en/api Stream raw keyboard input. Mode 1 is for raw physical input. Period is clamped between 1-1000 frames. ```python km.keyboard(1,100) >>> ``` -------------------------------- ### wheel(delta) Source: https://www.makcu.com/en/api Simulates scrolling with the mouse wheel. ```APIDOC ## wheel(delta) ### Description Simulates scrolling with the mouse wheel. ### Method SET (0x18) ### Parameters - `delta` (i8) - Required - The number of steps to scroll. Positive values scroll up, negative values scroll down. ### Response (SET) - `delta` (i8) - The scroll delta value. - `status` (u8) - Returns 0x00 (OK) on success, 0x01 (ERR) on error. ``` -------------------------------- ### Enable Echo Source: https://www.makcu.com/en/api Enables the echo feature. Use '1' for on and '0' for off. An empty parameter queries the current state. This is a SET request. ```python km.echo(1) >>> ``` -------------------------------- ### buttons([mode[,period_ms]]) Source: https://www.makcu.com/en/api Stream button states. Can be used to query the current mode and period, or to set the mode and period for button state streaming. Mode can be raw (1) or muted (2). Period is in milliseconds (1-1000ms). Requires baud rate of 1M or higher. Only emits on new frames. ```APIDOC ## buttons([mode[,period_ms]]) — GET/SET (0x02) ### Description Stream button states - mode: 1=raw 2=mut; period: 1-1000ms (rounded to bInterval); requires baud >= 1M; only emits on new frames ### Params () to query; (mode) set mode; (mode,period_ms) set mode and period. mode: 1=raw 2=mut; period: 1-1000ms ### Response (GET) ``` [0x02] Response: [0x02] [mode:u8] [period:u8] ``` Returns current streaming mode and period. ### Response (SET) ``` [0x02] [mode:u8] [period:u8] Response: [0x02] [status:u8] ``` Returns 0x00 (OK) on success, 0x01 (ERR) on error. ### Streaming format Device emits 2-byte binary frame when buttons change: ``` [0x02] [buttons_lo:u8] [buttons_hi:u8] ``` Buttons mask: bit 0=left, 1=right, 2=middle, 3=side1, 4=side2 ``` -------------------------------- ### hs([enable]) Source: https://www.makcu.com/en/api Control USB high-speed compatibility. This setting is persistent across reboots. Enable can be 0 (disable) or 1 (enable). ```APIDOC ## hs([enable]) — GET/SET (0xB7) ### Description USB high-speed compatibility - 0=disable, 1=enable (persistent) ### Params () to query; (enable) set high-speed mode. enable: 0=disable, 1=enable ### Response (GET) ``` [0xB7] Response: [0xB7] [enabled:u8] ``` ### Response (SET) ``` [0xB7] [enable:u8] Response: [0xB7] [status:u8] ``` Returns 0x00 (OK) on success, 0x01 (ERR) on error. Setting is persistent across reboots. ``` -------------------------------- ### Control Tilt/Z-axis Movement Source: https://www.makcu.com/en/api Sets or queries the tilt (Z-axis) steps. A query returns the pending steps, while setting requires specifying the number of steps. ```text [0x16] Response: [0x16] [pending:i8] ``` ```text [0x16] [steps:i8] Response: [0x16] [status:u8] ``` -------------------------------- ### Stream Keyboard Input (Constructed) Source: https://www.makcu.com/en/api Stream keyboard input as a constructed frame. Mode 2 is for constructed frames after remapping/masking. Period is clamped between 1-1000 frames. ```python km.keyboard(2,50) >>> ``` -------------------------------- ### string(text) Source: https://www.makcu.com/en/api Types an ASCII string using queued key presses with automatic timing and shift handling. ```APIDOC ## string(text) — SET ### Description Types an ASCII string using queued key presses with automatic timing. Handles Shift for uppercase letters and symbols. ### Parameters #### Path Parameters - **text** (string) - Required - ASCII string to type (max 256 characters). ### Request Example ``` km.string("Hello") ``` ``` km.string("Test123!") ``` ``` -------------------------------- ### Configure Mouse Catch Mode Source: https://www.makcu.com/en/api Sets or queries the mouse catch mode. Modes include off (0), inject (1), and lock (2). Queries the current mode if no parameter is provided. ```text [0x03] Response: [0x03] [mode:u8] ``` ```text [0x03] [mode:u8] Response: [0x03] [status:u8] ``` -------------------------------- ### Stream Mouse (Constructed) Source: https://www.makcu.com/en/api Stream mouse data as a constructed frame. Mode 2 is for constructed frames. Period is in milliseconds, between 1-1000ms. ```python km.mouse(2,25) >>> ``` -------------------------------- ### Stream Button States Source: https://www.makcu.com/en/api Configure and query button state streaming. Supports raw or muted modes and custom periods. Requires a baud rate of 1M or higher. ```text [0x02] Response: [0x02] [mode:u8] [period:u8] ``` ```text [0x02] [mode:u8] [period:u8] Response: [0x02] [status:u8] ``` ```text [0x02] [buttons_lo:u8] [buttons_hi:u8] ``` -------------------------------- ### tilt([steps]) Source: https://www.makcu.com/en/api Controls tilting or Z-axis movement. Can query pending tilt steps or set new ones. ```APIDOC ## tilt([steps]) ### Description Controls tilting or Z-axis movement. Can query pending tilt steps or set new ones. ### Method GET/SET (0x16) ### Parameters - `steps` (i8) - Optional - The number of steps for tilt. Positive values tilt up, negative values tilt down. ### Response (GET) - `pending` (i8) - The number of pending tilt steps. ### Response (SET) - `steps` (i8) - The number of tilt steps set. - `status` (u8) - Returns 0x00 (OK) on success, 0x01 (ERR) on error. ``` -------------------------------- ### Stream Mouse (Raw) Source: https://www.makcu.com/en/api Stream raw mouse data. Mode 1 is for raw input. Period is in milliseconds, between 1-1000ms. ```python km.mouse(1,10) >>> ``` -------------------------------- ### Baud Rate Change (Legacy) Source: https://www.makcu.com/en/api Set UART baud rate using a binary frame. This is a legacy method and requires a specific frame format. ```APIDOC ## Baud Rate Change (Legacy) ### Purpose Set UART baud rate using a binary frame (no ASCII command). ### Frame `DE AD ` ### Example (115200) ``` DE AD 05 00 A5 00 C2 01 00 ``` ### Breakdown `DE AD | 05 00(len=5) | A5 (cmd) |00 C2 01 00 (115200 LE)` ``` -------------------------------- ### Release Key Source: https://www.makcu.com/en/api Simulates releasing a key that is currently pressed, identified by its HID code. ```bash [0xAA] [key:u8] ``` -------------------------------- ### Set Log Level Source: https://www.makcu.com/en/api Sets the logging level. Levels range from 0 to 5. Setting persists for 3 power cycles, then automatically disables. This is a SET request. ```python km.log(3) >>> ``` -------------------------------- ### turbo() Source: https://www.makcu.com/en/api Controls rapid-fire for mouse buttons 1-5. Can set a specific delay, enable random delays, or disable the feature. ```APIDOC ## turbo() ### Description Rapid-fire for mouse buttons 1-5. Allows setting a specific delay, random delays, or disabling the feature. ### Method GET/SET ### Parameters - `button` (int8) - Optional - Specifies the button for random delay (35-75ms). - `delay_ms` (u16) - Optional - Sets the delay in milliseconds (1-5000ms). - `0` - Optional - Disables all rapid-fire. ### Response (GET) - `btn1-5_delay` (u16x5) - An array of 5 unsigned 16-bit integers representing the delay for each button. ### Response (SET) - `status` (u8) - Returns 0x00 (OK) on success, 0x01 (ERR) on error. ``` -------------------------------- ### Initialize Keyboard State Source: https://www.makcu.com/en/api Clears the current keyboard state and releases any keys that are currently held down. ```javascript km.init() ``` -------------------------------- ### Keyboard Commands Source: https://www.makcu.com/en/api Control keyboard input including key presses, state queries, and remapping. ```APIDOC ## disable([key1,key2,...] | [key,mode]) — GET/SET (0xA1) ### Description Disable keys. Mode: 0=enable, 1=disable. Can disable multiple keys. ### Method GET/SET ### Endpoint [0xA1] ### Parameters #### Path Parameters - **key** (u8) - Required - HID code of the key. - **mode** (u8) - Required - Enable (0) or disable (1) the key. - **key1, key2, ...** (u8) - Required - List of HID codes to disable. ### Response (GET) #### Success Response - **disabled_keys** (u8×N) - List of disabled HID codes. ### Response (SET) #### Success Response (0x00) - **status** (u8) - OK #### Error Response (0x01) - **status** (u8) - ERR ``` ```APIDOC ## down(key) — SET (0xA2) ### Description Press key down. ### Method SET ### Endpoint [0xA2] ### Parameters #### Path Parameters - **key** (u8) - Required - HID code of the key. ### Response (SET) #### Success Response (0x00) - **status** (u8) - OK #### Error Response (0x01) - **status** (u8) - ERR ``` ```APIDOC ## init() — SET (0xA3) ### Description Clear keyboard state. ### Method SET ### Endpoint [0xA3] ### Response (SET) #### Success Response (0x00) - **status** (u8) - OK #### Error Response (0x01) - **status** (u8) - ERR ``` ```APIDOC ## isdown(key) — GET (0xA4) ### Description Query if key is down. ### Method GET ### Endpoint [0xA4] ### Parameters #### Path Parameters - **key** (u8) - Required - HID code of the key. ### Response (GET) #### Success Response - **is_down** (u8) - 0 if key is up, 1 if key is down. ``` ```APIDOC ## mask(key[,mode]) — SET (0xA6) ### Description Mask key. Mode: 0=off, 1=on. ### Method SET ### Endpoint [0xA6] ### Parameters #### Path Parameters - **key** (u8) - Required - HID code of the key. - **mode** (u8) - Required - Mask state (0=off, 1=on). ### Response (SET) #### Success Response (0x00) - **status** (u8) - OK #### Error Response (0x01) - **status** (u8) - ERR ``` ```APIDOC ## press(key[,hold_ms[,rand_ms]]) — SET (0xA7) ### Description Tap key. hold_ms: hold time (0=random 35-85ms). rand_ms: randomization (optional). ### Method SET ### Endpoint [0xA7] ### Parameters #### Path Parameters - **key** (u8) - Required - HID code of the key. - **hold_ms** (u8) - Optional - Hold time in milliseconds (0 for random). - **rand_ms** (u8) - Optional - Randomization in milliseconds. ### Response (SET) #### Success Response (0x00) - **status** (u8) - OK #### Error Response (0x01) - **status** (u8) - ERR ``` ```APIDOC ## remap(source,target) — SET (0xA8) ### Description Remap keycode. target=0 clears remap (passthrough). ### Method SET ### Endpoint [0xA8] ### Parameters #### Path Parameters - **source** (u8) - Required - Source HID code. - **target** (u8) - Required - Target HID code (0 to clear). ### Response (SET) #### Success Response (0x00) - **status** (u8) - OK #### Error Response (0x01) - **status** (u8) - ERR ``` ```APIDOC ## string(text) — SET (0xA9) ### Description Type ASCII string. Max 256 chars. ### Method SET ### Endpoint [0xA9] ### Parameters #### Path Parameters - **text** (u8×N) - Required - ASCII bytes (max 256 bytes). ### Response (SET) #### Success Response (0x00) - **status** (u8) - OK #### Error Response (0x01) - **status** (u8) - ERR ``` ```APIDOC ## up(key) — SET (0xAA) ### Description Release key. ### Method SET ### Endpoint [0xAA] ### Parameters #### Path Parameters - **key** (u8) - Required - HID code of the key. ### Response (SET) #### Success Response (0x00) - **status** (u8) - OK #### Error Response (0x01) - **status** (u8) - ERR ``` -------------------------------- ### Scroll Mouse Wheel Up Source: https://www.makcu.com/en/api Simulates a single upward scroll step using the mouse wheel. Values greater than 1 are clamped to 1. ```text km.wheel(1) >>> ``` -------------------------------- ### remap(source,target) Source: https://www.makcu.com/en/api Remaps one key to another. Setting the target to 0 clears the remapping. ```APIDOC ## remap(source,target) — GET/SET ### Parameters #### Path Parameters - **source** (HID code or quoted string) - Required - The key to remap from. - **target** (HID code or quoted string) - Required - The key to remap to. Set to 0 to clear remapping. ### Request Example ``` km.remap('a','b') ``` ``` km.remap('a',0) ``` ``` -------------------------------- ### Send Raw Mouse Frame Source: https://www.makcu.com/en/api Sends a raw mouse frame with button states and axis values. The button mask mirrors current states, and axes are one-shot values. ```bash [0x0B] [buttons:u8] [x:i16] [y:i16] [wheel:i8] [pan:i8] [tilt:i8] ``` -------------------------------- ### Enable Turbo Mode with Default Delay Source: https://www.makcu.com/en/api Enables rapid-fire mode for a specific mouse button using the default random delay (35-75ms). ```text km.turbo(1) >>> ``` -------------------------------- ### Enable Turbo Mode for Mouse Button Source: https://www.makcu.com/en/api Enables rapid-fire mode for a specific mouse button with a specified delay in milliseconds. Delay is rounded to the mouse endpoint's bInterval for USB synchronization. Use button 0 to disable all turbo modes. ```text km.turbo(1, 500) >>> ``` ```text km.turbo(2, 250) >>> ``` -------------------------------- ### Simulate Key Press Source: https://www.makcu.com/en/api Simulates pressing a single key. The hold duration can be specified in milliseconds, with an optional randomization range. If hold duration is omitted, a random 35-75ms hold is used and logged. ```javascript km.press('a') ``` ```javascript km.press('d', 50) ``` ```javascript km.press('d', 50, 10) ``` -------------------------------- ### release([timer_ms]) — GET/SET (0xBC) Source: https://www.makcu.com/en/api Configures an auto-release timer. When the timer expires, all active locks, buttons, and keys are released. Setting timer_ms to 0 disables the timer. ```APIDOC ## release([timer_ms]) — GET/SET (0xBC) ### Description Auto-release timer - releases all active locks/buttons/keys when expired. ### Params - `() get status` - `(timer_ms) set timer 500-300000ms (5 min), (0) disables` ### Response (GET) - **Response**: `[0xBC] [timer_ms:u32]` ### Response (SET) - **Request**: `[0xBC] [timer_ms:u32]` - **Response**: `[0xBC] [status:u8]` ### Status Codes - `0x00 (OK)` on success - `0x01 (ERR)` on error ### Return Value (GET) - `0` if disabled - `timer_ms` in milliseconds if enabled ``` -------------------------------- ### Send Complete Raw Mouse Frame Source: https://www.makcu.com/en/api Sends a complete raw mouse frame. The `mo` command can be used to set mouse button states, movement deltas, and scroll values. Calling with `(0)` clears all states. ```APIDOC ## mo(buttons,x,y,wheel,pan,tilt) — SET ### Description Send complete raw mouse frame (SET only, no GET). (0) clears all; x,y,wheel,pan,tilt are one-shots; button mask mirrors button states. ### Params buttons: button mask; x,y: movement deltas; wheel,pan,tilt: scroll values ### Request Example ```python km.mo(1,10,5,0,0,0) ``` ```