We are using a third-party USB device called a Phidget Interface Kit. They offer a C# library to communicate with it. We can talk to it if we set our Unity project to use the old Input Manager, but if we switch to the new Input System or use both, then we get a persistent Resource Busy error when attempting to connect to it. It can’t be connected to if it’s already in use by anything else.
We can’t find code samples on how to destroy a device once it’s been removed, or better yet how to never add it in the first place. Is there an intended hook to do this, and if so could you provide a sample of it?
Unfortunately, no, I don’t think that’s currently possible.
Last I checked, at least on Windows, Unity will invariably open all HIDs it can get its hands on. There’s means of suppressing them being turned into InputDevices but yeah, as you found, Unity will still hold on to the file descriptors for them and thus block others.
Would be great if this could be influenced from the managed side such that any HID that isn’t actively turned into an InputDevice (managed side) will also not be held on to from the native side. It’s slightly complicated by the fact that this is an async process and an InputDevice may appear for a HID at a much later point than its discovery. Ideally, the native side would not actively open a HID until after the managed side has established a connection (i.e. it would only report the device’s presence and open a channel and send events only once the device has been connected to an InputDevice). This would also help with the input system getting useless HID events for devices it’s not interested in.