From adc8a3239f352b4577ae758ca2c9f21c5d0cfaab Mon Sep 17 00:00:00 2001 From: PaulStoffregen Date: Sun, 8 Oct 2017 13:12:35 -0700 Subject: [PATCH] Query device status, idVendor and idProduct --- USBHost_t36.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/USBHost_t36.h b/USBHost_t36.h index 5e28c88..9138c17 100644 --- a/USBHost_t36.h +++ b/USBHost_t36.h @@ -322,6 +322,9 @@ protected: // All USB device drivers inherit from this base class. class USBDriver : public USBHost { public: + operator bool() { return (device != nullptr); } + uint16_t idVendor() { return (device != nullptr) ? device->idVendor : 0; } + uint16_t idProduct() { return (device != nullptr) ? device->idProduct : 0; } // TODO: user-level functions // check if device is bound/active/online // query vid, pid