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 * Authors: 9 * Alexander von Gluck IV, kallisti5@unixzen.com 10 */ 11 #ifndef _USB_FTDI_H_ 12 #define _USB_FTDI_H_ 13 14 15 #include "SerialDevice.h" 16 17 18 /* supported vendor and product ids */ 19 #define VENDOR_FTDI 0x0403 20 21 const usb_serial_device kFTDIDevices[] = { 22 {VENDOR_FTDI, 0x8372, "FTDI 8U100AX serial converter"}, 23 {VENDOR_FTDI, 0x6001, "FTDI 8U232AM serial converter"}, 24 {VENDOR_FTDI, 0x6015, "FTDI FT231X serial converter"} 25 }; 26 27 #define FTDI_BUFFER_SIZE 64 28 29 30 class FTDIDevice : public SerialDevice { 31 public: 32 FTDIDevice(usb_device device, uint16 vendorID, 33 uint16 productID, const char *description); 34 35 virtual status_t AddDevice(const usb_configuration_info *config); 36 37 virtual status_t ResetDevice(); 38 39 virtual status_t SetLineCoding(usb_cdc_line_coding *coding); 40 virtual status_t SetControlLineState(uint16 state); 41 42 virtual void OnRead(char **buffer, size_t *numBytes); 43 virtual void OnWrite(const char *buffer, size_t *numBytes, 44 size_t *packetBytes); 45 46 private: 47 size_t fHeaderLength; 48 uint8 fStatusMSR; 49 uint8 fStatusLSR; 50 }; 51 52 53 #endif //_USB_FTDI_H_ 54