@@ -341,7 +341,7 @@ pub fn list_devices() -> Result<Vec<DeviceInfo>, FtStatus> {
341
341
/// Lists FTDI devices using the Linux file system.
342
342
///
343
343
/// There is a bug in the vendor driver where the `serial_number` and
344
- /// `description` fields may be blank on the FT4232H and FT2232H when only
344
+ /// `description` fields may be blank on the FT4232H(A) FT2232H when only
345
345
/// some of the ports are unbound from the `ftdi_sio` linux kernel module.
346
346
///
347
347
/// This will not work if you have a custom VID/PID programmed onto your FTDI
@@ -426,7 +426,7 @@ pub fn list_devices_fs() -> io::Result<Vec<DeviceInfo>> {
426
426
427
427
let port_letters: Option < & ' static [ char ] > = match device_type {
428
428
DeviceType :: FT2232H => Some ( & [ 'A' , 'B' ] ) ,
429
- DeviceType :: FT4232H => Some ( & [ 'A' , 'B' , 'C' , 'D' ] ) ,
429
+ DeviceType :: FT4232H | DeviceType :: FT4232HA => Some ( & [ 'A' , 'B' , 'C' , 'D' ] ) ,
430
430
_ => None ,
431
431
} ;
432
432
@@ -546,7 +546,7 @@ pub struct Ft232r {
546
546
/// ```no_run
547
547
/// use libftd2xx::{Ft2232h, Ftdi};
548
548
///
549
- /// let ft4232h : Ft2232h = Ftdi::new()?.try_into()?;
549
+ /// let ft2232h : Ft2232h = Ftdi::new()?.try_into()?;
550
550
/// # Ok::<(), libftd2xx::DeviceTypeError>(())
551
551
/// ```
552
552
#[ derive( Debug ) ]
@@ -571,6 +571,23 @@ pub struct Ft4232h {
571
571
ftdi : Ftdi ,
572
572
}
573
573
574
+ /// FT4232HA device.
575
+ ///
576
+ /// # Example
577
+ ///
578
+ /// Converting from an unknown FTDI device.
579
+ ///
580
+ /// ```no_run
581
+ /// use libftd2xx::{Ft4232ha, Ftdi};
582
+ ///
583
+ /// let ft4232ha: Ft4232ha = Ftdi::new()?.try_into()?;
584
+ /// # Ok::<(), libftd2xx::DeviceTypeError>(())
585
+ /// ```
586
+ #[ derive( Debug ) ]
587
+ pub struct Ft4232ha {
588
+ ftdi : Ftdi ,
589
+ }
590
+
574
591
/// FTD2XX functions common to all devices.
575
592
pub trait FtdiCommon {
576
593
/// FTDI device type.
@@ -622,6 +639,7 @@ pub trait FtdiCommon {
622
639
0x1800 => Ok ( DeviceType :: FT4222H_0 ) ,
623
640
0x1900 => Ok ( DeviceType :: FT4222H_1_2 ) ,
624
641
0x2100 => Ok ( DeviceType :: FT4222_PROG ) ,
642
+ 0x3600 => Ok ( DeviceType :: FT4232HA ) ,
625
643
_ => Err ( FtStatus :: OTHER_ERROR ) ,
626
644
}
627
645
}
@@ -1642,7 +1660,7 @@ pub trait FtdiCommon {
1642
1660
/// It is the responsibility of the application to close the handle after
1643
1661
/// successfully calling this method.
1644
1662
///
1645
- /// For FT4232H, FT2232H and FT2232 devices, `cycle_port` will only work
1663
+ /// For FT4232H(A) , FT2232H and FT2232 devices, `cycle_port` will only work
1646
1664
/// under Windows XP and later.
1647
1665
///
1648
1666
/// # Example
@@ -1857,7 +1875,7 @@ pub trait FtdiEeprom<
1857
1875
///
1858
1876
/// # Example
1859
1877
///
1860
- /// This example uses the FT232H .
1878
+ /// This example uses the FT4232H .
1861
1879
///
1862
1880
/// ```no_run
1863
1881
/// use libftd2xx::{Ft4232h, Ftdi, FtdiEeprom};
@@ -2061,7 +2079,7 @@ impl Ftdi {
2061
2079
}
2062
2080
2063
2081
impl Ft232h {
2064
- /// Open a `Ft4232h ` device and initialize the handle.
2082
+ /// Open a `Ft232h ` device and initialize the handle.
2065
2083
///
2066
2084
/// # Safety
2067
2085
///
@@ -2272,6 +2290,59 @@ impl Ft4232h {
2272
2290
}
2273
2291
}
2274
2292
2293
+ impl Ft4232ha {
2294
+ /// Open a `Ft4232ha` device and initialize the handle.
2295
+ ///
2296
+ /// # Safety
2297
+ ///
2298
+ /// This is **unchecked** meaning a device type check will not be performed.
2299
+ /// Methods that require this specific device type may fail in unexpected
2300
+ /// ways if the wrong device is used.
2301
+ ///
2302
+ /// # Example
2303
+ ///
2304
+ /// ```no_run
2305
+ /// use libftd2xx::Ft4232ha;
2306
+ ///
2307
+ /// let mut ft = unsafe { Ft4232ha::with_serial_number_unchecked("FT4PWSEOA")? };
2308
+ /// # Ok::<(), libftd2xx::FtStatus>(())
2309
+ /// ```
2310
+ pub unsafe fn with_serial_number_unchecked ( serial_number : & str ) -> Result < Ft4232ha , FtStatus > {
2311
+ let handle = ft_open_ex ( serial_number, FT_OPEN_BY_SERIAL_NUMBER ) ?;
2312
+ Ok ( Ft4232ha {
2313
+ ftdi : Ftdi { handle } ,
2314
+ } )
2315
+ }
2316
+
2317
+ /// Open a `Ft4232ha` device and initialize the handle.
2318
+ ///
2319
+ /// # Example
2320
+ ///
2321
+ /// ```no_run
2322
+ /// use libftd2xx::Ft4232ha;
2323
+ ///
2324
+ /// Ft4232ha::with_serial_number("FT4PWSEOA")?;
2325
+ /// # Ok::<(), libftd2xx::DeviceTypeError>(())
2326
+ /// ```
2327
+ pub fn with_serial_number ( serial_number : & str ) -> Result < Ft4232ha , DeviceTypeError > {
2328
+ Ftdi :: with_serial_number ( serial_number) ?. try_into ( )
2329
+ }
2330
+
2331
+ /// Open a `Ft4232ha` device by its device description.
2332
+ ///
2333
+ /// # Example
2334
+ ///
2335
+ /// ```no_run
2336
+ /// use libftd2xx::Ft4232ha;
2337
+ ///
2338
+ /// Ft4232ha::with_description("Quad RS232-HS A")?;
2339
+ /// # Ok::<(), libftd2xx::DeviceTypeError>(())
2340
+ /// ```
2341
+ pub fn with_description ( description : & str ) -> Result < Ft4232ha , DeviceTypeError > {
2342
+ Ftdi :: with_description ( description) ?. try_into ( )
2343
+ }
2344
+ }
2345
+
2275
2346
impl FtdiCommon for Ftdi {
2276
2347
const DEVICE_TYPE : DeviceType = DeviceType :: Unknown ;
2277
2348
@@ -2351,11 +2422,13 @@ impl_boilerplate_for!(Ft232h, DeviceType::FT232H);
2351
2422
impl_boilerplate_for ! ( Ft232r , DeviceType :: FT232R ) ;
2352
2423
impl_boilerplate_for ! ( Ft2232h , DeviceType :: FT2232H ) ;
2353
2424
impl_boilerplate_for ! ( Ft4232h , DeviceType :: FT4232H ) ;
2425
+ impl_boilerplate_for ! ( Ft4232ha , DeviceType :: FT4232HA ) ;
2354
2426
2355
2427
impl_try_from_for ! ( Ft232h ) ;
2356
2428
impl_try_from_for ! ( Ft232r ) ;
2357
2429
impl_try_from_for ! ( Ft2232h ) ;
2358
2430
impl_try_from_for ! ( Ft4232h ) ;
2431
+ impl_try_from_for ! ( Ft4232ha ) ;
2359
2432
2360
2433
impl FtdiEeprom < FT_EEPROM_232H , Eeprom232h > for Ft232h { }
2361
2434
impl FtdiEeprom < FT_EEPROM_232R , Eeprom232r > for Ft232r { }
@@ -2366,6 +2439,8 @@ impl FtdiMpsse for Ft232h {}
2366
2439
impl FtdiMpsse for Ft232r { }
2367
2440
impl FtdiMpsse for Ft2232h { }
2368
2441
impl FtdiMpsse for Ft4232h { }
2442
+ impl FtdiMpsse for Ft4232ha { }
2369
2443
impl Ftx232hMpsse for Ft232h { }
2370
2444
impl Ftx232hMpsse for Ft2232h { }
2371
2445
impl Ftx232hMpsse for Ft4232h { }
2446
+ impl Ftx232hMpsse for Ft4232ha { }
0 commit comments