Conversation
nathankellenicki
left a comment
There was a problem hiding this comment.
Thanks for this, this looks very useful! I added a few small comments.
I noticed that the changes for port mode info were added to lpf2hub.ts which seems correct, but did you test this with a WeDo 2.0 Smart Hub, to check its handled gracefully?
If you don't have one to hand I can test myself when I get back home in a couple of weeks. But I won't block the merging of this on that.
| "webpack-cli": "^3.3.10" | ||
| }, | ||
| "bin": { | ||
| "lpf2-hubinfo": "./bin/hubinfo" |
There was a problem hiding this comment.
For consistency with this library name, could we call it poweredup-hubinfo? I'm not sure LPF2 is the right name to use given that its Lego internal only, and most people know the technology as Powered UP.
| quiet = true; | ||
| break; | ||
| default: | ||
| console.log("Usage: lpf2-hubinfo [-p|--portinfo] [-q|--quiet]"); |
There was a problem hiding this comment.
The process never quits, likely as Noble is still running in the background. Can you add something like process.exit(0);?
| const typeName = Consts.HubTypeNames[hub.type] || `unknown (${toHex(hub.type)})`; | ||
| console.log(`${hub.uuid} firmware v${hub.firmwareVersion} hardware v${hub.hardwareVersion} ${typeName} (${hubName})`); | ||
| if (hub instanceof LPF2Hub && !portInfo) { | ||
| await hub.shutdown(); |
There was a problem hiding this comment.
Could we add another process.exit(0); here so that the process terminates after shutting down the hub?
Added a tool which can display information about discovered hubs (including detailed port information).
Example output