hevz / hubpower Goto Github PK
View Code? Open in Web Editor NEWControl the power settings for a USB hub
Control the power settings for a USB hub
it works very well!
Very serious issue.
I believe I just tried a power off command and my USB ports are currently power cycling (about 0.25s on then 0.75s off). The power cycling is only on the hub which I tried to control, not the onboard USB ports (they're fine).
Additionally, when I try to issue another hubpower command, my entire OS locks up.
I'm on a Raspberry Pi with Raspian for what it's worth.
Cool bit of code - would like to use some of it - what's the license?
Hello - I downloaded hubpower.c and compiled with:
gcc -o hubpower hubpower.c - and it compiled ok.
Here is what I get when I use it:
wolff@wolff:/Documents/install/hubpower$ lsusb/Documents/install/hubpower$ ./hubpower 0781:5575 power off
Bus 001 Device 003: ID 0a5c:5801 Broadcom Corp. BCM5880 Secure Applications Processor with fingerprint swipe sensor
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 0781:5575 SanDisk Corp. Cruzer Glide
Bus 003 Device 003: ID 2357:0604 TP-Link TP-Link UB500 Adapter
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
wolff@wolff:
Usage: hubpower busnum:devnum power {portnum (on|off)} ...
hubpower busnum:devnum reset {portnum (on|off)} ...
hubpower busnum:devnum enable {portnum (on|off)} ...
hubpower busnum:devnum status
hubpower busnum:devnum bind
wolff@wolff:/Documents/install/hubpower$ ./hubpower 0781:5575 power on/Documents/install/hubpower$ ./hubpower 0781:5575 power
Usage: hubpower busnum:devnum power {portnum (on|off)} ...
hubpower busnum:devnum reset {portnum (on|off)} ...
hubpower busnum:devnum enable {portnum (on|off)} ...
hubpower busnum:devnum status
hubpower busnum:devnum bind
wolff@wolff:
Usage: hubpower busnum:devnum power {portnum (on|off)} ...
hubpower busnum:devnum reset {portnum (on|off)} ...
hubpower busnum:devnum enable {portnum (on|off)} ...
hubpower busnum:devnum status
hubpower busnum:devnum bind
wolff@wolff:~/Documents/install/hubpower$ ./hubpower 0781:5575 status
Usage: hubpower busnum:devnum power {portnum (on|off)} ...
hubpower busnum:devnum reset {portnum (on|off)} ...
hubpower busnum:devnum enable {portnum (on|off)} ...
hubpower busnum:devnum status
hubpower busnum:devnum bind
Seems to always give me the help menu
19:32:59 [aboettger:~] % gcc -o hubpower hubpower.c
hubpower.c: In function ‘port_status’:
hubpower.c:85:13: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
portnum, strerror(errno));
^
hubpower.c: In function ‘main’:
hubpower.c:173:21: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
fname1, strerror(err1));
^
hubpower.c:175:21: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
fname2, strerror(errno));
^
hubpower.c:269:21: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
portnum, strerror(errno));
^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.