mirror of
https://github.com/cathery/sys-con.git
synced 2025-02-04 21:39:56 +00:00
Add vendor/product members to IUSBDevice
This commit is contained in:
parent
d6ddf1c933
commit
3509f2c223
@ -10,6 +10,9 @@ class IUSBDevice
|
||||
protected:
|
||||
std::vector<std::unique_ptr<IUSBInterface>> m_interfaces{};
|
||||
|
||||
uint16_t m_vendorID;
|
||||
uint16_t m_productID;
|
||||
|
||||
public:
|
||||
virtual ~IUSBDevice() = default;
|
||||
|
||||
@ -22,4 +25,7 @@ public:
|
||||
|
||||
//Get the raw reference to interfaces vector.
|
||||
virtual std::vector<std::unique_ptr<IUSBInterface>> &GetInterfaces() { return m_interfaces; }
|
||||
|
||||
virtual uint16_t GetVendor() { return m_vendorID; }
|
||||
virtual uint16_t GetProduct() { return m_productID; }
|
||||
};
|
@ -44,10 +44,15 @@ void SwitchUSBDevice::Reset()
|
||||
|
||||
void SwitchUSBDevice::SetInterfaces(UsbHsInterface *interfaces, int length)
|
||||
{
|
||||
m_interfaces.clear();
|
||||
m_interfaces.reserve(length);
|
||||
for (int i = 0; i != length; ++i)
|
||||
if (length > 0)
|
||||
{
|
||||
m_interfaces.push_back(std::make_unique<SwitchUSBInterface>(interfaces[i]));
|
||||
m_vendorID = interfaces->device_desc.idVendor;
|
||||
m_productID = interfaces->device_desc.idProduct;
|
||||
m_interfaces.clear();
|
||||
m_interfaces.reserve(length);
|
||||
for (int i = 0; i != length; ++i)
|
||||
{
|
||||
m_interfaces.push_back(std::make_unique<SwitchUSBInterface>(interfaces[i]));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user