companion icon indicating copy to clipboard operation
companion copied to clipboard

[BUG] Plugging a Contour Shuttle into a different USB port treats it as a different device

Open arikorn opened this issue 6 months ago • 0 comments

Make sure you're on the latest stable or beta build

  • [x] I have tested this on the latest stable or beta release

Is this a bug in companion itself or a module?

  • [x] I believe this to be a bug in companion and not a specific module

Is there an existing issue for this?

  • [x] I have searched the existing issues

Describe the bug

Apparently, the Contour Shuttle does not supply its serial number via the USB protocol. As a result the Contour Shuttle device code fakes an ID here in order to provide a unique deviceID.

The only problem is that the fakeDeviceId is set to a different value for each USB port. So if you plug the Contour into a different USB port, even on the same computer, you "lose" your settings (more precisely, a new instance of the surface is created). Needless to say, this makes it a bit messy/tricky to share the Contour Shuttle across computers (for example, programming everything one one computer then installing it at the onsite computer).

My best guess for the need for a unique ID is in case you want to use two Contour Shuttles simultaneously. While such a configuration is certainly physically possible, it is probably quite rare. (Does the manufacturer even support it? I only have one, so can't test.) And, TBH, the Companion driver wouldn't even support it properly since, for example, there is only a single global "shuttle" variable.

My suggestion would be to replace the fakeDeviceId value with a simple serial number such as

      `${contourShuttle.info.name}_${n}`

(or contourShuttle.info.productModelId instead of name??) where n is just the index number of the device of that type (which may need a bit of extra code to track that number, of course).

This would no doubt solve the problem for the majority of users, though at the first time upon upgrading it may "break" existing instances in the same way that plugging into a different USB port currently breaks them. The only issue that I can see is in the case of two simultaneous Contour Shuttles: it might be difficult to ensure which physical device is assigned to which internal ID. (In the current scheme, as long as they're always plugged into the same USB port the identities will be preserved. But then again, that "as long as" makes it still pretty fraught... And again, it's not clear to me that two simultaneous Shuttles would work properly even now.)

If there's some way to check for existing instances of the surface, perhaps one could compare hashes, and use the USB-port-based hash if there's a match. This would avoid breaking existing instances as well as conserving the identity of a second simultaneous Contour Shuttle.

Steps To Reproduce

  1. Plug in a Contour Shuttle (after having enabled scanning for it in Settings, of course)
  2. In the Surfaces menu adjust its settings for offset or page number.
  3. Unplug the Shuttle and plug it into a different USB port.
  4. Rescan USB if necessary
  5. Note that the "Location" of the surface you just adjusted is marked as "offline" and a new instance of the surface has been created with all settings back at the default.

Expected Behavior

Plugging a device into a different USB port should not change its identity! (As is true for devices such as the Stream Deck.)

Environment (please complete the following information)

- OS: Windows 10
- Browser: Chrome
- Companion Version: 4.0.1

Additional context

No response

arikorn avatar Jun 16 '25 22:06 arikorn