pub fn description(&self) -> Result<DeviceDescription> {
        unsafe {
            let mut desc = std::mem::MaybeUninit::uninit();
            let err = uvc_get_device_descriptor(self.dev.as_ptr(), desc.as_mut_ptr()).into();
            if err != Error::Success {
                return Err(err);
            }

            let desc = desc.assume_init();

            let vendor_id = (*desc).idVendor;
            let product_id = (*desc).idProduct;
            let bcd_uvc = (*desc).bcdUVC;

            let serial_number_c_str = (*desc).serialNumber;
            let serial_number = if serial_number_c_str.is_null() {
                None
            } else {
                Some(
                    CStr::from_ptr(serial_number_c_str)
                        .to_owned()
                        .into_string()
                        .unwrap(),
                )
            };
            let manufacturer_c_str = (*desc).manufacturer;
            let manufacturer = if manufacturer_c_str.is_null() {
                None
            } else {
                Some(
                    CStr::from_ptr(manufacturer_c_str)
                        .to_owned()
                        .into_string()
                        .unwrap(),
                )
            };
            let product_c_str = (*desc).product;
            let product = if product_c_str.is_null() {
                None
            } else {
                Some(
                    CStr::from_ptr(product_c_str)
                        .to_owned()
                        .into_string()
                        .unwrap(),
                )
            };
            let descp = Ok(DeviceDescription {
                vendor_id,
                product_id,
                bcd_uvc,
                serial_number,
                manufacturer,
                product,
            });

            uvc_free_device_descriptor(desc);

            descp
        }
    }
/// Get the description of a device
Get the description of a device
Get the description of a device
pub fn description(&self) -> Result<DeviceDescription> {
        unsafe {
            let mut desc = std::mem::MaybeUninit::uninit();
            let err = uvc_get_device_descriptor(self.dev.as_ptr(), desc.as_mut_ptr()).into();
            if err != Error::Success {
                return Err(err);
            }
            let desc = desc.assume_init();
            let vendor_id = (*desc).idVendor;
            let product_id = (*desc).idProduct;
            let bcd_uvc = (*desc).bcdUVC;
            let serial_number_c_str = (*desc).serialNumber;
            let serial_number = if serial_number_c_str.is_null() {
                None
            } else {
                Some(
                    CStr::from_ptr(serial_number_c_str)
                        .to_owned()
                        .into_string()
                        .unwrap(),
                )
            };
            let manufacturer_c_str = (*desc).manufacturer;
            let manufacturer = if manufacturer_c_str.is_null() {
                None
            } else {
                Some(
                    CStr::from_ptr(manufacturer_c_str)
                        .to_owned()
                        .into_string()
                        .unwrap(),
                )
            };
            let product_c_str = (*desc).product;
            let product = if product_c_str.is_null() {
                None
            } else {
                Some(
                    CStr::from_ptr(product_c_str)
                        .to_owned()
                        .into_string()
                        .unwrap(),
                )
            };
            let descp = Ok(DeviceDescription {
                vendor_id,
                product_id,
                bcd_uvc,
                serial_number,
                manufacturer,
                product,
            });
            uvc_free_device_descriptor(desc);
            descp
        }
    }
pub fn description ( & self ) -> Result < DeviceDescription > { unsafe { let mut desc = std :: mem :: MaybeUninit :: uninit ( ) ; let err = uvc_get_device_descriptor ( self . dev . as_ptr ( ) , desc . as_mut_ptr ( ) ) . into ( ) ; if err != Error :: Success { return Err ( err ) ; } let desc = desc . assume_init ( ) ; let vendor_id = ( * desc ) . idVendor ; let product_id = ( * desc ) . idProduct ; let bcd_uvc = ( * desc ) . bcdUVC ; let serial_number_c_str = ( * desc ) . serialNumber ; let serial_number = if serial_number_c_str . is_null ( ) { None } else { Some ( CStr :: from_ptr ( serial_number_c_str ) . to_owned ( ) . into_string ( ) . unwrap ( ) , ) } ; let manufacturer_c_str = ( * desc ) . manufacturer ; let manufacturer = if manufacturer_c_str . is_null ( ) { None } else { Some ( CStr :: from_ptr ( manufacturer_c_str ) . to_owned ( ) . into_string ( ) . unwrap ( ) , ) } ; let product_c_str = ( * desc ) . product ; let product = if product_c_str . is_null ( ) { None } else { Some ( CStr :: from_ptr ( product_c_str ) . to_owned ( ) . into_string ( ) . unwrap ( ) , ) } ; let descp = Ok ( DeviceDescription { vendor_id , product_id , bcd_uvc , serial_number , manufacturer , product , } ) ; uvc_free_device_descriptor ( desc ) ; descp } }
Get the description of a device
Get the description of a device
&self
&self