aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-08-08 11:37:24 -0400
committerBrian Cully <bjc@kublai.com>2019-08-08 11:37:24 -0400
commit532a5ea6a5ab7efcec834264af5bd80c2bdfb615 (patch)
tree490f5959668f41b7c19771ff0a3437b26e3f51ed /src/lib.rs
parentb6dfb525beec5f16617b382847ebbae9b31ac6e8 (diff)
downloadbootkbd-532a5ea6a5ab7efcec834264af5bd80c2bdfb615.tar.gz
bootkbd-532a5ea6a5ab7efcec834264af5bd80c2bdfb615.zip
Pass config_index into SetConfig enum.
Assume we'll figure out which index to use when parsing configurations.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 4e345d4..3842e57 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,7 +2,7 @@
#![no_std]
-use log::{debug, error, info};
+use log::{debug, error};
use usb_host::{
ConfigurationDescriptor, DescriptorType, DeviceDescriptor, Direction, Driver, DriverError,
Endpoint, RequestCode, RequestDirection, RequestKind, RequestRecipient, RequestType,
@@ -91,7 +91,7 @@ enum DeviceState {
Addressed,
WaitForSettle(usize),
GetConfig,
- SetConfig,
+ SetConfig(u8),
SetIdle,
SetReport,
Running,
@@ -203,12 +203,12 @@ impl Device {
)?;
assert!(len == conf_desc.w_total_length as usize);
- self.state = DeviceState::SetConfig
+ // TODO: browse configs and pick the "best" one. But
+ // this should always be ok, at least.
+ self.state = DeviceState::SetConfig(1)
}
- DeviceState::SetConfig => {
- // TODO: extract real configuration to choose.
- let conf: u8 = 1;
+ DeviceState::SetConfig(config_index) => {
host.control_transfer(
&mut self.ep0,
RequestType::from((
@@ -217,7 +217,7 @@ impl Device {
RequestRecipient::Device,
)),
RequestCode::SetConfiguration,
- WValue::from((conf, 0)),
+ WValue::from((config_index, 0)),
0,
none,
)?;