Don't die if there is no unique name

This commit is contained in:
Corey Richardson 2017-05-28 17:25:54 -04:00
parent 3e15ed1f1d
commit 53b4a6d65e
No known key found for this signature in database
GPG key ID: A89E9F8FB71E9B8B

View file

@ -722,10 +722,14 @@ impl Device {
dev.phys = Some(CString::new(vec.clone()).unwrap()); dev.phys = Some(CString::new(vec.clone()).unwrap());
} }
let uniq_len = unsafe { eviocguniq(fd, vec.as_mut_ptr(), 255) }?; match unsafe { eviocguniq(fd, vec.as_mut_ptr(), 255) } {
if uniq_len > 0 { Ok(uniq_len) => {
unsafe { vec.set_len(uniq_len as usize - 1) }; if uniq_len > 0 {
dev.uniq = Some(CString::new(vec.clone()).unwrap()); 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)); do_ioctl!(eviocgid(fd, &mut dev.id));