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-2004 by Siarzhuk Zharski <imker@gmx.li> 6 * Distributed under the terms of the MIT License. 7 */ 8 #ifndef _USB_KLSI_H_ 9 #define _USB_KLSI_H_ 10 11 #include "SerialDevice.h" 12 13 /* supported vendor and product ids */ 14 #define VENDOR_PALM 0x0830 15 #define VENDOR_KLSI 0x05e9 16 #define PRODUCT_PALM_CONNECT 0x0080 17 #define PRODUCT_KLSI_KL5KUSB105D 0x00c0 18 19 /* protocol defines */ 20 #define KLSI_SET_REQUEST 0x01 21 #define KLSI_POLL_REQUEST 0x02 22 #define KLSI_CONF_REQUEST 0x03 23 #define KLSI_CONF_REQUEST_READ_ON 0x03 24 #define KLSI_CONF_REQUEST_READ_OFF 0x02 25 26 // not sure 27 #define KLSI_BUFFER_SIZE 64 28 29 enum { 30 klsi_sio_b115200 = 0, 31 klsi_sio_b57600 = 1, 32 klsi_sio_b38400 = 2, 33 klsi_sio_b19200 = 4, 34 klsi_sio_b9600 = 6, 35 /* unchecked */ 36 klsi_sio_b4800 = 8, 37 klsi_sio_b2400 = 9, 38 klsi_sio_b1200 = 10, 39 klsi_sio_b600 = 11, 40 klsi_sio_b300 = 12 41 }; 42 43 44 class KLSIDevice : public SerialDevice { 45 public: 46 KLSIDevice(usb_device device, uint16 vendorID, 47 uint16 productID, const char *description); 48 49 virtual status_t AddDevice(const usb_configuration_info *config); 50 51 virtual status_t ResetDevice(); 52 53 virtual status_t SetLineCoding(usb_cdc_line_coding *coding); 54 55 virtual void OnRead(char **buffer, size_t *numBytes); 56 virtual void OnWrite(const char *buffer, size_t *numBytes, 57 size_t *packetBytes); 58 virtual void OnClose(); 59 }; 60 61 #endif //_USB_KLSI_H_ 62