/*
	general interface to "USB flash device" via usblib
	
	
	credits go to "space2" from forum.se-nse.net
*/
#include "comport.h"

#ifndef __COMPORT_LINUX_DCU60_H__
#define __COMPORT_LINUX_DCU60_H__

#include <usb.h>
#define kOurVendorID        3035
#define kOurProductID       4110

class comportUSB: public comport
{
public:
	comportUSB();
	~comportUSB();
	
	bool isUSB();

	bool open( char*devicename );
	bool isopen();
	void close();
	
	bool setspeed( unsigned long speed );
	unsigned long getspeed() { return speed; };
	
	unsigned long sendbyte( unsigned char b );
	unsigned long sendbytes( void *b, unsigned long num );
	
	unsigned long recvbyte( void *b );
	unsigned long recvbytes( void *b, unsigned long num );

private:
	struct usb_device * dev;
	struct usb_dev_handle * dev_handle;
	int if_nr; // interface number
	int epi_nr, epo_nr; // end point addresses
	unsigned long speed;
	char portname[2000];
	unsigned int	readbuffer_size;
	unsigned int	readbuffer_position;
	unsigned char	readbuffer[0x10000];

};

#endif
