Skip to content

Commit cdbfd94

Browse files
committed
correct sysfs path -> dev path
1 parent 980b993 commit cdbfd94

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

examples/printer.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,19 @@ fn main() -> io::Result<()> {
120120

121121
// wait for sysfs device to create
122122
let mut count = 0;
123-
let mut sysfs_path = None;
123+
let mut dev_path = None;
124124
println!("Attempt open device path: {}", DEV_PATH);
125125
while count < 5 {
126126
std::thread::sleep(std::time::Duration::from_secs(1));
127127
// test open access
128-
if let Ok(_) = OpenOptions::new().read(true).write(true).open(&SYSFS_PATH) {
129-
sysfs_path = Some(PathBuf::from(SYSFS_PATH));
128+
if let Ok(_) = OpenOptions::new().read(true).write(true).open(&DEV_PATH) {
129+
dev_path = Some(PathBuf::from(DEV_PATH));
130130
break;
131131
}
132132
count += 1;
133133
}
134134

135-
match sysfs_path {
135+
match dev_path {
136136
Some(pp) => {
137137
let mut file = OpenOptions::new().read(true).write(true).open(&pp)?;
138138

@@ -146,9 +146,8 @@ fn main() -> io::Result<()> {
146146
Ok(())
147147
}
148148
}
149-
None => Err(io::Error::new(
150-
io::ErrorKind::NotFound,
151-
format!("Printer {} not found or cannot open", SYSFS_PATH),
152-
)),
149+
_ => {
150+
Err(io::Error::new(io::ErrorKind::NotFound, format!("Printer {} not found or cannot open", DEV_PATH)))
151+
}
153152
}
154153
}

0 commit comments

Comments
 (0)