Managing a usb port from the command line using shell scripts

Background: I have these USB lights that I want to turn on and off based on notifications (e.g. build failures).

I realized that the easiest way is to turn on the light in the USB port and simply mount / unmount based on the received emails. On a Mac, a device connected to a USB device is not included as a mounted drive.

Are there any interesting tips for creating your own build monitor?

+4
source share
2 answers

My impression is that most of these devices simply extract power from the USB port and do not have a specific software presence. Thus, turning them off using software will require figuring out how to turn off the power for a particular USB port. Although probably not impossible, it’s not necessary, it’s something like what will be shown in a convenient high-level API.

+1
source

I have no idea which device you have, but you can only install disks (for example, USB drives, external hard drives, MP3 players, etc.). Or do you expect your mouse to be mounted?

There is no universal command line tool that I know to interact with USB the way you like, and I cannot imagine it as simple as, say, a simple old serial or parallel port. USB devices have different classes of devices (for example, audio and a printer), and one of them means, in fact, service communication and can be anything. Even with the birth classes, communication is already very difficult.

Thus, you will need to obtain documentation for these lights (how to control them), and if there is not yet a special tool that supports these lights, you will need to write it yourself.

+1
source

All Articles