44 lines
888 B
C++
44 lines
888 B
C++
#include "log.h"
|
|
#include "json.hpp"
|
|
#include <string>
|
|
#include <cstdio>
|
|
#include <memory>
|
|
#include <stdexcept>
|
|
#include <array>
|
|
#include <sstream>
|
|
#include <regex>
|
|
#include <libudev.h>
|
|
#include <fstream>
|
|
#include <iomanip>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
#include <dirent.h>
|
|
#include <cstring>
|
|
#include <fcntl.h>
|
|
#define CURRENTDIR "/home/leo/devCode/outer/USBFilter_30/usbFilter"
|
|
|
|
|
|
using namespace std;
|
|
using json = nlohmann::json;
|
|
|
|
class usbFilter
|
|
{
|
|
private:
|
|
/* data */
|
|
public:
|
|
usbFilter(/* args */);
|
|
~usbFilter();
|
|
void StartSrv();
|
|
void StopSrv();
|
|
string EnumDriversAndDevices();
|
|
bool open(const string &devPath);
|
|
|
|
private:
|
|
string sysfsToDevPath(const string& sysfs_path);
|
|
string convertUsbSysfsPath(const string& sysfs_path);
|
|
string convertPciSysfsPath(const string& sysfs_path);
|
|
int getDeviceUserPID(const string& devpath);
|
|
|
|
};
|
|
|