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 {
89
89
Self :: open_impl ( path. as_ref ( ) , true )
90
90
}
91
91
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
+
92
99
/// Opens a V4L2 device file from the given path.
93
100
///
94
101
/// 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};
16
16
const HFLIP_UNIT_SELECTOR : u8 = 0x0c ;
17
17
const VFLIP_UNIT_SELECTOR : u8 = 0x0d ;
18
18
const UVC_EXTENSION_UNIT : u8 = 0x03 ;
19
+ const EXPOSURE_WEIGHTS_UNIT_SELECTOR : u8 = 0x09 ;
19
20
20
21
/// `UVCH` meta capture format.
21
22
#[ derive( Clone , Copy , Debug ) ]
@@ -86,7 +87,7 @@ impl<'a> UvcExt<'a> {
86
87
}
87
88
88
89
pub fn horizontal_flip ( & mut self ) -> io:: Result < ( ) > {
89
- self . set_control (
90
+ self . control_query (
90
91
UVC_EXTENSION_UNIT ,
91
92
HFLIP_UNIT_SELECTOR ,
92
93
XuQuery :: SET_CUR ,
@@ -95,15 +96,33 @@ impl<'a> UvcExt<'a> {
95
96
}
96
97
97
98
pub fn vertical_flip ( & mut self ) -> io:: Result < ( ) > {
98
- self . set_control (
99
+ self . control_query (
99
100
UVC_EXTENSION_UNIT ,
100
101
VFLIP_UNIT_SELECTOR ,
101
102
XuQuery :: SET_CUR ,
102
103
& mut [ 1 , 0 ] ,
103
104
)
104
105
}
105
106
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 > (
107
126
& self ,
108
127
unit : u8 ,
109
128
selector : u8 ,
You can’t perform that action at this time.
0 commit comments