USBDeviceSwift icon indicating copy to clipboard operation
USBDeviceSwift copied to clipboard

Question : How to handle multiple devices of the same type

Open haskins-io opened this issue 4 years ago • 0 comments

Hi,

loving the code. I have a question about how it can be modified to handle multiple connections of the same device.

Let's say I have two USB Mice, both are made by the same manufacturer, so both have the same vendor id and product id. When a button on mouse 1 is pressed I want to print "Hello", and when a button on the other mouse is pressed I want to print "World".

The read function receives all the data from the press of a mouse button, but I can't work out how to tie this back to a device that was detected in the rawDeviceAdded function.

It there anyway of doing this?

Thanks

haskins-io avatar Apr 22 '20 14:04 haskins-io