File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,13 @@ impl Device {
8989 Self :: open_impl ( path. as_ref ( ) , true )
9090 }
9191
92+ pub fn try_clone ( & self ) -> io:: Result < Self > {
93+ Ok ( Self {
94+ file : self . file . try_clone ( ) ?,
95+ available_capabilities : self . available_capabilities ,
96+ } )
97+ }
98+
9299 /// Opens a V4L2 device file from the given path.
93100 ///
94101 /// If the path does not refer to a V4L2 device node, an error will be returned.
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ use self::raw::{XuControlQuery, XuQuery};
1616const HFLIP_UNIT_SELECTOR : u8 = 0x0c ;
1717const VFLIP_UNIT_SELECTOR : u8 = 0x0d ;
1818const UVC_EXTENSION_UNIT : u8 = 0x03 ;
19+ const EXPOSURE_WEIGHTS_UNIT_SELECTOR : u8 = 0x09 ;
1920
2021/// `UVCH` meta capture format.
2122#[ derive( Clone , Copy , Debug ) ]
@@ -86,7 +87,7 @@ impl<'a> UvcExt<'a> {
8687 }
8788
8889 pub fn horizontal_flip ( & mut self ) -> io:: Result < ( ) > {
89- self . set_control (
90+ self . control_query (
9091 UVC_EXTENSION_UNIT ,
9192 HFLIP_UNIT_SELECTOR ,
9293 XuQuery :: SET_CUR ,
@@ -95,15 +96,33 @@ impl<'a> UvcExt<'a> {
9596 }
9697
9798 pub fn vertical_flip ( & mut self ) -> io:: Result < ( ) > {
98- self . set_control (
99+ self . control_query (
99100 UVC_EXTENSION_UNIT ,
100101 VFLIP_UNIT_SELECTOR ,
101102 XuQuery :: SET_CUR ,
102103 & mut [ 1 , 0 ] ,
103104 )
104105 }
105106
106- fn set_control < const SIZE : usize > (
107+ pub fn set_auto_exposure_weights ( & mut self , weights : & mut [ u8 ; 17 ] ) -> io:: Result < ( ) > {
108+ self . control_query (
109+ UVC_EXTENSION_UNIT ,
110+ EXPOSURE_WEIGHTS_UNIT_SELECTOR ,
111+ XuQuery :: SET_CUR ,
112+ weights,
113+ )
114+ }
115+
116+ pub fn get_auto_exposure_weights ( & mut self , out : & mut [ u8 ; 17 ] ) -> io:: Result < ( ) > {
117+ self . control_query (
118+ UVC_EXTENSION_UNIT ,
119+ EXPOSURE_WEIGHTS_UNIT_SELECTOR ,
120+ XuQuery :: GET_CUR ,
121+ out,
122+ )
123+ }
124+
125+ fn control_query < const SIZE : usize > (
107126 & self ,
108127 unit : u8 ,
109128 selector : u8 ,
You can’t perform that action at this time.
0 commit comments