Build V4L2 ioctl command numbers at compile time. 在编译时构造 V4L2 ioctl 命令号。 Linux ioctl encoding: `direction(2) | size(14) | type(8) | nr(8)` Linux ioctl 编码:`方向(2) | 大小(14) | 类型(8) | 编号(8)`
(dir: u32, typ: u8, nr: u8, size: usize)
| 28 | /// Linux ioctl encoding: `direction(2) | size(14) | type(8) | nr(8)` |
| 29 | /// Linux ioctl 编码:`方向(2) | 大小(14) | 类型(8) | 编号(8)` |
| 30 | const fn ioc(dir: u32, typ: u8, nr: u8, size: usize) -> u32 { |
| 31 | (dir << 30) | ((size as u32 & 0x3FFF) << 16) | ((typ as u32) << 8) | (nr as u32) |
| 32 | } |
| 33 | const fn ior<T>(typ: u8, nr: u8) -> u32 { |
| 34 | ioc(2, typ, nr, mem::size_of::<T>()) |
| 35 | } |