Move all drivers to /usr/lib/drivers

This makes them harder to accidentally run them from the shell, which
would not work. In the future this may also allow embedding the driver
config in the driver executable itself without having to look at all
non-driver executables too.
This commit is contained in:
bjorn3
2024-06-16 17:02:14 +02:00
parent a9bb925f25
commit 4ffed8096d
4 changed files with 18 additions and 8 deletions
+5 -5
View File
@@ -5,21 +5,21 @@
name = "AHCI storage"
class = 1
subclass = 6
command = ["ahcid"]
command = ["/scheme/initfs/lib/drivers/ahcid"]
# ided
[[drivers]]
name = "IDE storage"
class = 1
subclass = 1
command = ["ided"]
command = ["/scheme/initfs/lib/drivers/ided"]
# nvmed
[[drivers]]
name = "NVME storage"
class = 1
subclass = 8
command = ["nvmed"]
command = ["/scheme/initfs/lib/drivers/nvmed"]
[[drivers]]
name = "virtio-blk"
@@ -27,11 +27,11 @@ class = 1
subclass = 0
vendor = 0x1AF4
device = 0x1001
command = ["virtio-blkd"]
command = ["/scheme/initfs/lib/drivers/virtio-blkd"]
[[drivers]]
name = "virtio-gpu"
class = 3
vendor = 0x1AF4
device = 0x1050
command = ["virtio-gpud"]
command = ["/scheme/initfs/lib/drivers/virtio-gpud"]
+5
View File
@@ -28,6 +28,11 @@ impl DriverHandler {
let mut args = args.iter();
if let Some(program) = args.next() {
let program = if program.starts_with('/') {
program.to_owned()
} else {
"/usr/lib/drivers/".to_owned() + program
};
let mut command = Command::new(program);
for arg in args {
if arg.starts_with("$") {
+3 -3
View File
@@ -2,16 +2,16 @@
name = "SCSI over USB"
class = 8 # Mass Storage class
subclass = 6 # SCSI transparent command set
command = ["/bin/usbscsid", "$SCHEME", "$PORT", "$IF_PROTO"]
command = ["usbscsid", "$SCHEME", "$PORT", "$IF_PROTO"]
[[drivers]]
name = "USB HUB"
class = 9 # HUB class
subclass = -1
command = ["/bin/usbhubd", "$SCHEME", "$PORT", "$IF_NUM"]
command = ["usbhubd", "$SCHEME", "$PORT", "$IF_NUM"]
[[drivers]]
name = "USB HID"
class = 3 # HID class
subclass = -1
command = ["/bin/usbhidd", "$SCHEME", "$PORT", "$IF_NUM"]
command = ["usbhidd", "$SCHEME", "$PORT", "$IF_NUM"]
+5
View File
@@ -847,6 +847,11 @@ impl Xhci {
info!("Loading subdriver \"{}\"", driver.name);
let (command, args) = driver.command.split_first().ok_or(Error::new(EBADMSG))?;
let command = if command.starts_with('/') {
command.to_owned()
} else {
"/usr/lib/drivers/".to_owned() + command
};
let process = process::Command::new(command)
.args(
args.into_iter()