Comments (6)
X-keys have a unit ID, (UID) so 2 devices with the same Product ID (PID) can be distinguished. The UID once set remains with the device. Factory new they are often 0, and it can be incremented (0 to 255) so two devices on the same machine are not the same. This may be better than the path which could change in a replug event.
I can elaborate more on UIDs and their uses if this method looks like it would work.
Michael
from xkeys.
It would help if the devices already had the uid set. At the moment a user with, say, 2 new devices would have to ensure that at least one of them had a new uid set before plugging in the second device - otherwise they'd have two devices with probably the same uid=0.
A problem with factory set uids is that 0-255 is not a huge range so a user could conceivably end up with multiple devices having the same uid. That's perhaps unlikely but not impossible, so a user assigned uid is probably preferable. I just noticed in issue #27 that there has been some thought about automatic uid assignment. That would definitely help and is something I can try locally - bearing in mind the warning about EEPROM writes being limited to a few thousand :)
However a problem of making the uid unique at scale remains. It's not a problem for me but I can imagine a business with multiple devices on multiple machines having to move device(s) between machines for some reason. There would be a high likelihood of a machine ending up with devices having the same uid.
Back to availability of devicePath, I'm not sure that the possibility of a path change after a replug event is a big issue. The first part of a replug is a disconnect event which should have been handled by the application e.g. by removing the device from its device list etc. The second part of that replug is a connect event so the app just sees a new connection which it handles as usual (by adding to its device list etc.). The fact that the device might (or not) have a new path doesn't really matter; at least not for the way I was using the devicePath. Having the devicePath exposed again (as it was in v2.0.0) works better for me.
from xkeys.
Good points @cwilling !
I've implemented my idea from #27 and also added back the devicePath, in the PR #48 .
@cwilling could you have a look at that (npm install [email protected]
), and let me know if it solves your direct issue?
The issue with having unique ids at scale remains, but I don't think that it's something we'll be able to solve in this library.
from xkeys.
Thanks, devicePath is working again in 2.2.0-alpha.1 although after thinking more about it all, the automatic uniqueIdentifier idea is very attractive too.
I see that the auto uid allocation has been added to the watcher. Would it not also (or instead) be useful to be in xkeys itself?
from xkeys.
Well, it's a close call I suppose. Since the watcher is the one handling connected/disconnected-events I thought it would fit best in there.
from xkeys.
Version 2.2.0 has been published to npm
from xkeys.
Related Issues (20)
- this.deviceType.banks 2 on console when setting backlightintensity HOT 2
- Console log statement becomes rather spammy HOT 2
- Handling of USB disconnect/reconnect HOT 6
- Support for XKE-64 JogT-bar HOT 2
- Log for XKE-128 HOT 1
- Discussion: Major updates to the library HOT 16
- XK-12 Joystick using wrong bits HOT 8
- XK-8 support HOT 15
- Feature: WebHID HOT 1
- Closing down neatly HOT 4
- Can XKeysWatcher handle existing connections? HOT 2
- Backlight methods HOT 6
- Help with building HOT 8
- Any known problems with Raspberry Pi? HOT 2
- XKeys.listAllConnectedPanels is not a function HOT 9
- How to dispose of an xkeysPanel? HOT 10
- call a xkeys function out of the watcher HOT 4
- UnhandledPromiseRejectionWarning when watcher fails to open device HOT 1
- npm packages have a lot of 'junk' files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xkeys.