@@ -375,7 +375,7 @@ where
375375 let ( _, event) = match device. next_event ( evdev_rs:: ReadFlag :: NORMAL ) {
376376 Ok ( event) => event,
377377 Err ( _) => {
378- let device_fd = device. fd ( ) . unwrap ( ) . into_raw_fd ( ) ;
378+ let device_fd = device. file ( ) . as_raw_fd ( ) ;
379379 let empty_event = epoll:: Event :: new ( epoll:: Events :: empty ( ) , 0 ) ;
380380 epoll:: ctl ( epoll_fd, EPOLL_CTL_DEL , device_fd, empty_event) ?;
381381 continue ' events;
@@ -469,8 +469,8 @@ where
469469}
470470
471471fn inotify_devices ( ) -> io:: Result < Inotify > {
472- let mut inotify = Inotify :: init ( ) ?;
473- inotify. add_watch ( DEV_PATH , WatchMask :: CREATE ) ?;
472+ let inotify = Inotify :: init ( ) ?;
473+ inotify. watches ( ) . add ( DEV_PATH , WatchMask :: CREATE ) ?;
474474 Ok ( inotify)
475475}
476476
@@ -485,7 +485,7 @@ fn add_device_to_epoll_from_inotify_event(
485485 // new plug events
486486 let file = File :: open ( device_path) ?;
487487 let fd = file. as_raw_fd ( ) ;
488- let device = Device :: new_from_fd ( file) ?;
488+ let device = Device :: new_from_file ( file) ?;
489489 let event = epoll:: Event :: new ( EPOLLIN , devices. len ( ) as u64 ) ;
490490 devices. push ( device) ;
491491 epoll:: ctl ( epoll_fd, EPOLL_CTL_ADD , fd, event) ?;
@@ -501,7 +501,7 @@ fn setup_devices() -> io::Result<(RawFd, Vec<Device>, Vec<UInputDevice>)> {
501501 let epoll_fd = epoll_watch_all ( device_files. iter ( ) ) ?;
502502 let devices = device_files
503503 . into_iter ( )
504- . map ( Device :: new_from_fd )
504+ . map ( Device :: new_from_file )
505505 . collect :: < io:: Result < Vec < Device > > > ( ) ?;
506506 let output_devices = devices
507507 . iter ( )
0 commit comments