Added Usb Detection using libUsb

This commit is contained in:
2022-11-12 18:29:04 +01:00
parent 815e67bdfb
commit d7dfdc4739
8 changed files with 171 additions and 106 deletions

View File

@@ -10,21 +10,28 @@
using namespace ptprnt;
int main(int argc, char** argv) {
void setupLogger() {
spdlog::set_level(spdlog::level::debug);
spdlog::info("Starting ptprnt {}", PROJ_VERSION);
auto usb = std::make_unique<driver::Usb>();
auto devs = usb->listDevices();
}
for (auto dev : devs) {
int main(int argc, char** argv) {
setupLogger();
auto usb = std::make_shared<driver::Usb>();
auto maybeDevs = usb->getDevices();
if(!maybeDevs.has_value()) {
spdlog::error("No USB devices found");
return -1;
}
/*auto driver = std::make_unique<driver::P700Driver>();
auto printer = std::make_unique<printer::P700Printer>(std::move(driver));
printer::info info = printer->getInfo();*/
auto driver = std::make_unique<driver::P700Driver>(usb);
//auto printer = std::make_unique<printer::P700Printer>(std::move(driver));
//printer::info info = printer->getInfo();
return 0;
}