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,11 +722,15 @@ impl Device {
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) } {
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));
let mut driver_version: i32 = 0;