-
Notifications
You must be signed in to change notification settings - Fork 44
hid-service: add timeout for I2C device operations #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,13 +1,17 @@ | ||||||||||
| use core::borrow::BorrowMut; | ||||||||||
|
|
||||||||||
| use embassy_sync::mutex::Mutex; | ||||||||||
| use embassy_time::{Duration, with_timeout}; | ||||||||||
| use embedded_hal_async::i2c::{AddressMode, I2c}; | ||||||||||
| use embedded_services::hid::{DeviceContainer, InvalidSizeError, Opcode, Response}; | ||||||||||
| use embedded_services::{GlobalRawMutex, buffer::*}; | ||||||||||
| use embedded_services::{error, hid, info, trace}; | ||||||||||
|
|
||||||||||
| use crate::Error; | ||||||||||
|
|
||||||||||
| const DEVICE_RESPONSE_TIMEOUT_MS: u64 = 200; | ||||||||||
| const DATA_READ_TIMEOUT_MS: u64 = 50; | ||||||||||
|
|
||||||||||
|
Comment on lines
11
to
+14
|
||||||||||
| const DEVICE_RESPONSE_TIMEOUT_MS: u64 = 200; | |
| const DATA_READ_TIMEOUT_MS: u64 = 50; | |
| use crate::{DEVICE_RESPONSE_TIMEOUT_MS, DATA_READ_TIMEOUT_MS}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RobertZ2011 I copied these timeouts from the
host.rs. Do these timeouts make sense communication with HID passthrough device?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
200 ms is a good default that should be good for most use cases, but long-term I think these should be configuration options passed into the device. The spec uses 16 bits for length and that would take ~5 seconds at 100 KHz.