Troubleshooting
Key or mouse events are not being sent
If the device is not sending key or mouse events to the host, one of the following may be the cause:
Incorrect state type in
maincontextEnsure the
Contexttype passed tomainuses the correct state type.rust#[lokey::device] async fn main(context: Context<..., ..., MyState>) { ... }Missing keyboard or mouse report state
Ensure your state type includes
KeyboardReportStateand/orMouseReportState.rust#[derive(Default, State)] struct MyState { keyboard_report: KeyboardReportState, mouse_report: MouseReportState, // ... }Missing layer manager
If you are using the
PerLayeraction or thelayout!macro, ensure your state type includesLayerManagerand the field has the#[state(query)]attribute.rust#[derive(Default, State)] struct MyState { #[state(query)] layer_manager: LayerManager<0>, // ... }
Firmware crashes after startup
If the device firmware panics shortly after startup, one of the following may be the cause:
Resource limits are not configured correctly
The configured resource limits may be too low for your firmware. Additionally, if resources are not configured at all, they default to 0, which causes a panic as soon as one of those resources is used.
Use the following features to configure resource limits:
max-internal-message-size-*internal-receiver-slots-*external-receiver-slots-*external-observer-slots-*
See the API documentation of
lokeyfor more information.