pub fn new_addr(ctx: &mut Context, addr: CardAddress) -> Result<K8055> {
        let mut d = None;
        {
            for dev in ctx.devices().unwrap().iter() {
                let desc = try!(
                    dev.device_descriptor()
                        .chain_err(|| "Unable to get device description")
                );
                if addr == CardAddress::CARD_ANY {
                    if desc.vendor_id() == VENDOR_ID
                        && CardAddress::CARD_1.bits == desc.product_id()
                        || CardAddress::CARD_2.bits == desc.product_id()
                        || CardAddress::CARD_3.bits == desc.product_id()
                        || CardAddress::CARD_4.bits == desc.product_id()
                    {
                        d = Some(dev);
                        break;
                    }
                } else if desc.vendor_id() == VENDOR_ID && addr.bits == desc.product_id() {
                    d = Some(dev);
                    break;
                }
            }
        }
        if d.is_some() {
            let k8055 = K8055 {
                dev: d,
                hd: None,
                state: Default::default(),
            };
            Ok(k8055)
        } else {
            Err(libusb::Error::NotFound.into())
        }
    }
/// Create a new K8055 instance with a specific card address.
///
/// See the hardware jumpers on the card for your card's address. May return `None` if no card
/// with the address `addr` can be found connected to the system.
Create a new K8055 instance with a specific card address.
See the hardware jumpers on the card for your card's address. May return `None` if no card
with the address `addr` can be found connected to the system.
Create a new K8055 instance with a specific card address . See the hardware jumpers on the card for your card ' s address . May return ` None ` if no card with the address ` addr ` can be found connected to the system .
pub fn new_addr(ctx: &mut Context, addr: CardAddress) -> Result<K8055> {
        let mut d = None;
        {
            for dev in ctx.devices().unwrap().iter() {
                let desc = try!(
                    dev.device_descriptor()
                        .chain_err(|| "Unable to get device description")
                );
                if addr == CardAddress::CARD_ANY {
                    if desc.vendor_id() == VENDOR_ID
                        && CardAddress::CARD_1.bits == desc.product_id()
                        || CardAddress::CARD_2.bits == desc.product_id()
                        || CardAddress::CARD_3.bits == desc.product_id()
                        || CardAddress::CARD_4.bits == desc.product_id()
                    {
                        d = Some(dev);
                        break;
                    }
                } else if desc.vendor_id() == VENDOR_ID && addr.bits == desc.product_id() {
                    d = Some(dev);
                    break;
                }
            }
        }
        if d.is_some() {
            let k8055 = K8055 {
                dev: d,
                hd: None,
                state: Default::default(),
            };
            Ok(k8055)
        } else {
            Err(libusb::Error::NotFound.into())
        }
    }
pub fn new_addr ( ctx : & mut Context , addr : CardAddress ) -> Result < K8055 > { let mut d = None ; { for dev in ctx . devices ( ) . unwrap ( ) . iter ( ) { let desc = try ! ( dev device_descriptor ( ) chain_err ( " " ) ) ; if addr == CardAddress :: CARD_ANY { if desc . vendor_id ( ) == VENDOR_ID && CardAddress :: CARD_1 . bits == desc . product_id ( ) || CardAddress :: CARD_2 . bits == desc . product_id ( ) || CardAddress :: CARD_3 . bits == desc . product_id ( ) || CardAddress :: CARD_4 . bits == desc . product_id ( ) { d = Some ( dev ) ; break ; } } else if desc . vendor_id ( ) == VENDOR_ID && addr . bits == desc . product_id ( ) { d = Some ( dev ) ; break ; } } } if d . is_some ( ) { let k8055 = K8055 { dev : d , hd : None , state : Default :: default ( ) , } ; Ok ( k8055 ) } else { Err ( libusb :: Error :: NotFound . into ( ) ) } }
Create a new K8055 instance with a specific card address.
Create a new K8055 instance with a specific card address .
ctx
&mut Context
addr
CardAddress
ctx
&mut Context
addr
CardAddress