1 /* 2 * Copyright (c) 2007-2008 by Michael Lotz 3 * Heavily based on the original usb_serial driver which is: 4 * 5 * Copyright (c) 2003 by Siarzhuk Zharski <imker@gmx.li> 6 * Distributed under the terms of the MIT License. 7 */ 8 #ifndef _USB_FTDI_H_ 9 #define _USB_FTDI_H_ 10 11 #include "SerialDevice.h" 12 13 /* supported vendor and product ids */ 14 #define VENDOR_FTDI 0x0403 15 #define PRODUCT_FTDI_8U100AX 0x8372 16 #define PRODUCT_FTDI_8U232AM 0x6001 17 18 #define FTDI_BUFFER_SIZE 64 19 20 21 class FTDIDevice : public SerialDevice { 22 public: 23 FTDIDevice(usb_device device, uint16 vendorID, 24 uint16 productID, const char *description); 25 26 virtual status_t AddDevice(const usb_configuration_info *config); 27 28 virtual status_t ResetDevice(); 29 30 virtual status_t SetLineCoding(usb_serial_line_coding *coding); 31 virtual status_t SetControlLineState(uint16 state); 32 33 virtual void OnRead(char **buffer, size_t *numBytes); 34 virtual void OnWrite(const char *buffer, size_t *numBytes, 35 size_t *packetBytes); 36 37 private: 38 size_t fHeaderLength; 39 uint8 fStatusMSR; 40 uint8 fStatusLSR; 41 }; 42 43 #endif //_USB_FTDI_H_ 44