Giter Site home page Giter Site logo

hub-ctrl-for-openwrt's Introduction

hub-ctrl-for-openwrt

hub-ctrl allows you to switch off power on USB ports on USB hubs that have the hardware necessary to allow software controlled power switching.

This repository contains a Makefile that allows a hub-ctrl package to be built using the OpenWrt SDK. A precompiled binary package for ar71xx (e.g., TP-Link TL-WR703N, TL-WR710N; D-Link DIR-505) is available on https://github.com/probonopd/hub-ctrl-for-openwrt/releases/tag/1.0

Building

To build, download and unpack the OpenWrt SDK, then clone this repository into your ./package subdirectory of the unpacked OpenWrt SDK:

cd ./package/
git clone https://github.com/probonopd/hub-ctrl-for-openwrt.git
cd -

Make sure the Makefile is in package/hub-ctrl/Makefile in the OpenWrt SDK, then run scripts/feeds install libusb-compat and finally make V=s. This will create ./bin/ar71xx/packages/base/hub-ctrl_1_ar71xx.ipk (depending on your architecture).

Using

You can control the power on a port using the following command.

sudo ./hub-ctrl -h 3 -P 1 -p 0

That says to control hub 3 (-h 3) port 1 (-P 1) and to turn the power off (-p 0). You can also use โ€-p 1โ€ to turn the power back on.

You can also specify the USB device based on the BUS and DEV numbers. Use the following command the list the currently connected devices. It's useful to run this with the device disconnected and then again with the device connected so that you can tell which device is the one you are trying to target (the Targus in my case).

lsusb

Now that we know the BUS and DEV numbers, we can control the power using those numbers as well. Here's the command for that.

sudo ./hub-ctrl -b 001 -d 005 -P1 -p 0

This time we are controlling the device on BUS 001 (-b 001) device 005 (-d 005) port 1 (-P 1) and turning the power off (-p 0).

More information, including upstream copyright information, can be found at https://github.com/codazoda/hub-ctrl.c/

hub-ctrl-for-openwrt's People

Contributors

probonopd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.