-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hubinfo tool #51
base: master
Are you sure you want to change the base?
hubinfo tool #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -32,5 +32,8 @@ | |||
"typescript": "^3.7.2", | |||
"webpack": "^4.41.2", | |||
"webpack-cli": "^3.3.10" | |||
}, | |||
"bin": { | |||
"lpf2-hubinfo": "./bin/hubinfo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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