1. USB Network Gate daemon is managed via libeveusb library (libeveusb.so) which can be found in 'lib' folder under USB Network Gate installation path. 


2. To use the library, you will need header files which are stored in the ‹install_dir›/include/eveusb folder. 


There are three of them: eveusbfwd.h, eveusb.h and device.h. These files provide the API for C++ programming language. 


eveusbfwd.h contains forward declarations for classes and structures declared in other headers. 


device.h contains declaration for class Device that represents local or remote USB devices (or USB ports, if more precisely). 


eveusb.h contains API for daemon management. 


3. libeveusb does not have library dependencies (except for dependency on libstdc++) and does not use exceptions or threads. 


4. All declarations are placed in 'namespace electronic'. 


5. To get the daemon events, inherit from the pure abstract class EveusbEventHandler and implement all its virtual member functions. 


The typical code sample is the following (basing on Qt library usage): 

class WindowMain : private electronic::EveusbEventHandler, ... 


class WindowMain : private electronic::EveusbEventHandler, ... 




QLocalSocket *m_socket; 

electronic::EveusbController m_ctl; 

long writeToDaemon(const void *buf, size_t count); 

long readFromDaemon(void *buf, size_t count); 




connect(m_socket, SIGNAL(connected()), 

SLOT(socket_connected())); connect(m_socket, 

SIGNAL(readyRead()), SLOT(socket_readyRead())); 

m_socket->connectToServer(electronic::EveusbController::getSocketPath()) ; // now you can call any members of m_ctl 

void WindowMain::socket_connected() 


void WindowMain::socket_readyRead() 

while (qint64 cnt = m_socket->bytesAvailable()) { 

if (int err = m_ctl.onDataAvailable(cnt)) { 


// strerror(err) 


long WindowMain::writeToDaemon(const void *buf, size_t count) { 

return m_socket->write(buf, count); 

long WindowMain::readFromDaemon(void *buf, size_t count) 

return m_socket->read(data, count); 



6. As far as the sample shows, the library does not manage the local socket. The socket should be created and managed by you, including data writing/reading and errors management.


To get the socket, call the following function: 


int EveusbController::connect() 


The command returns open file descriptor. If the error occurs, -1 is returned. 


7. The following function returns the path to Unix socket


std::string EveusbController::getSocketPath() 


It can be used instead of EveusbController::connect(). 


Anyway, the socket should be closed by you, not the library. 


8. When a user manages the socket operations themselves, they can use third-party APIs, e.g. select() and poll() system calls, boost::asio, QLocalSocket from Qt library, and so on. 


9. The encoding format for all strings is UTF-8 


10. All EveusbController members are asynchronous


Each member sends a request to the daemon and returns the error code. 


If the request is sent successfully (that is, error code is zero), the 

corresponding EveusbEventHandler virtual function is called once the daemon reply is