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
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue