Don't die if there is no unique name
This commit is contained in:
parent
3e15ed1f1d
commit
53b4a6d65e
1 changed files with 8 additions and 4 deletions
12
src/lib.rs
12
src/lib.rs
|
@ -722,10 +722,14 @@ impl Device {
|
|||
dev.phys = Some(CString::new(vec.clone()).unwrap());
|
||||
}
|
||||
|
||||
let uniq_len = unsafe { eviocguniq(fd, vec.as_mut_ptr(), 255) }?;
|
||||
if uniq_len > 0 {
|
||||
unsafe { vec.set_len(uniq_len as usize - 1) };
|
||||
dev.uniq = Some(CString::new(vec.clone()).unwrap());
|
||||
match unsafe { eviocguniq(fd, vec.as_mut_ptr(), 255) } {
|
||||
Ok(uniq_len) => {
|
||||
if uniq_len > 0 {
|
||||
unsafe { vec.set_len(uniq_len as usize - 1) };
|
||||
dev.uniq = Some(CString::new(vec.clone()).unwrap());
|
||||
}
|
||||
},
|
||||
Err(_) => { /* it's not essential */ }
|
||||
}
|
||||
|
||||
do_ioctl!(eviocgid(fd, &mut dev.id));
|
||||
|
|
Loading…
Reference in a new issue