Fix scheme name for xhcid and launch drivers

This commit is contained in:
Jeremy Soller
2022-02-14 09:38:31 -07:00
parent 88a6eb17e9
commit 0cd3a6b797
2 changed files with 10 additions and 8 deletions
+3 -2
View File
@@ -231,8 +231,9 @@ fn main() {
format!(" + XHCI {} on: {} IRQ: {}\n", name, bar, irq)
);
let scheme_name = format!("usb/{}", name);
let socket_fd = syscall::open(
format!(":usb/{}", name),
format!(":{}", scheme_name),
syscall::O_RDWR | syscall::O_CREAT,
)
.expect("xhcid: failed to create usb scheme");
@@ -240,7 +241,7 @@ fn main() {
File::from_raw_fd(socket_fd as RawFd)
}));
let hci = Arc::new(Xhci::new(name, address, interrupt_method, pcid_handle).expect("xhcid: failed to allocate device"));
let hci = Arc::new(Xhci::new(scheme_name, address, interrupt_method, pcid_handle).expect("xhcid: failed to allocate device"));
xhci::start_irq_reactor(&hci, irq_file);
futures::executor::block_on(hci.probe()).expect("xhcid: failed to probe");
+7 -6
View File
@@ -524,11 +524,10 @@ impl Xhci {
self.update_default_control_pipe(&mut *input, slot, dev_desc).await?;
}
/*match self.spawn_drivers(i, &mut port_state) {
match self.spawn_drivers(i) {
Ok(()) => (),
Err(err) => error!("Failed to spawn driver for port {}: `{}`", i, err),
}*/
}
}
}
@@ -712,15 +711,17 @@ impl Xhci {
}
}
fn spawn_drivers(&self, port: usize, ps: &mut PortState) -> Result<()> {
fn spawn_drivers(&self, port: usize) -> Result<()> {
// TODO: There should probably be a way to select alternate interfaces, and not just the
// first one.
// TODO: Now that there are some good error crates, I don't think errno.h error codes are
// suitable here.
let ps = self.port_states.get(&port).unwrap();
let ifdesc = &ps
.dev_desc
.as_ref().unwrap()
.as_ref().ok_or(Error::new(EBADF))?
.config_descs
.first()
.ok_or(Error::new(EBADF))?
@@ -737,7 +738,7 @@ impl Xhci {
.map(|subclass| subclass == ifdesc.sub_class)
.unwrap_or(true)
}) {
info!("Loading subdriver\"{}\"", driver.name);
info!("Loading subdriver \"{}\"", driver.name);
let (command, args) = driver.command.split_first().ok_or(Error::new(EBADMSG))?;
let if_proto = ifdesc.protocol;