We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3e92f66 + 2ffd460 commit e43e168Copy full SHA for e43e168
src/lib.rs
@@ -57,6 +57,7 @@ use std::fs::{File};
57
mod error;
58
pub use error::Error;
59
60
+#[derive(Debug)]
61
pub struct Pin {
62
pin_num : u64,
63
}
@@ -109,7 +110,7 @@ impl Pin {
109
110
111
fn read_from_device_file(&self, dev_file_name: &str) -> io::Result<String> {
112
let gpio_path = format!("/sys/class/gpio/gpio{}/{}", self.pin_num, dev_file_name);
- let mut dev_file = try!(File::create(&gpio_path));
113
+ let mut dev_file = try!(File::open(&gpio_path));
114
let mut s = String::new();
115
try!(dev_file.read_to_string(&mut s));
116
Ok(s)
@@ -325,6 +326,7 @@ impl Pin {
325
326
327
328
329
330
pub struct PinPoller {
331
332
epoll_fd : RawFd,
0 commit comments