From 4809f60d2cd881cc27fc4eb9b972a3cb72b3a07a Mon Sep 17 00:00:00 2001 From: Moritz Martinius Date: Tue, 8 Nov 2022 19:51:11 +0100 Subject: [PATCH] List usb device --- .vscode/launch.json | 2 +- .vscode/settings.json | 77 ++++++++++++++++++++++++++++++++++++++++++- inc/P700Driver.hpp | 2 -- meson.build | 3 +- src/P700Driver.cpp | 2 +- src/main.cpp | 12 +++++-- 6 files changed, 90 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index de2a0ca..91bbc21 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "(gdb) Starten", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/ptprnt", + "program": "${workspaceFolder}/builddir/ptprnt", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", diff --git a/.vscode/settings.json b/.vscode/settings.json index 0a9c556..bd3632f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,80 @@ "--background-index", "--compile-commands-dir=${workspaceFolder}/builddir", "-std=c++17" - ] + ], + "files.associations": { + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "array": "cpp", + "atomic": "cpp", + "strstream": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cfenv": "cpp", + "chrono": "cpp", + "codecvt": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "source_location": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "semaphore": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cinttypes": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "valarray": "cpp", + "variant": "cpp" + } } \ No newline at end of file diff --git a/inc/P700Driver.hpp b/inc/P700Driver.hpp index d6e050c..c5a9723 100644 --- a/inc/P700Driver.hpp +++ b/inc/P700Driver.hpp @@ -2,8 +2,6 @@ #include -#include - #pragma once namespace ptprnt::driver { diff --git a/meson.build b/meson.build index d97ae9e..460c233 100644 --- a/meson.build +++ b/meson.build @@ -11,7 +11,8 @@ incdir = include_directories('inc') srcs = [ 'src/main.cpp', 'src/P700Driver.cpp', - 'src/P700Printer.cpp' + 'src/P700Printer.cpp', + 'src/Usb.cpp' ] executable( diff --git a/src/P700Driver.cpp b/src/P700Driver.cpp index b228d88..163b0d6 100644 --- a/src/P700Driver.cpp +++ b/src/P700Driver.cpp @@ -8,7 +8,7 @@ namespace ptprnt::driver { P700Driver::P700Driver(uint16_t UsbDevVendor, uint16_t UsbDevId) {} P700Driver::~P700Driver() { - libusb_init(NULL); + } driver::info P700Driver::getInfo() { diff --git a/src/main.cpp b/src/main.cpp index 2d564cc..f697b18 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ #include "IPrinter.hpp" #include "P700Printer.hpp" +#include "Usb.hpp" #include using namespace ptprnt; @@ -11,9 +12,16 @@ int main(int argc, char** argv) { std::cout << "Hello ptprnt!" << std::endl; - auto driver = std::make_unique(); + auto usb = std::make_unique(); + auto devs = usb->listDevices(); + + for (auto dev : devs) { + + } + + /*auto driver = std::make_unique(); auto printer = std::make_unique(std::move(driver)); - printer::info info = printer->getInfo(); + printer::info info = printer->getInfo();*/ return 0; } \ No newline at end of file