Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

hubinfo tool #51

wants to merge 2 commits into from

Conversation

nutki
Copy link
Contributor

@nutki nutki commented Nov 15, 2019

Added a tool which can display information about discovered hubs (including detailed port information).

Example output

e07dea09c7a1 firmware v1.2.00.0000 hardware v1.0.00.0000 DUPLO_TRAIN_HUB (Train Base)
90842b0e7cad firmware v1.1.02.0000 hardware v0.1.00.0000 POWERED_UP_HUB (HUB NO.4)
0081f9059568 firmware v1.0.00.0004 hardware v1.0.00.0000 POWERED_UP_REMOTE ()
001653b4d6a9 firmware v2.0.00.0017 hardware v0.4.00.0000 BOOST_MOVE_HUB (LEGO Move Hub)

Copy link
Owner

@nathankellenicki nathankellenicki left a 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"
Copy link
Owner

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]");
Copy link
Owner

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();
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants