Question

I have an UPS attached via USB port to my linux machine. Unfortunately the UPS is unsupported and doesn't show up as a reconized device. However it DOES show up correctly with the lsusb command.

I'd like to read the battery status from my UPS via a simple bash script (triggered by cron for example). I don't want a fully functional script as it would require to know the protocol of the specific UPS; I just want to create a script to write raw commands and read raw responses to/from the UPS given the known USB address, then it will be up to me to encode the actual command and parse the response.

Thank you.

Était-ce utile?

La solution

You might be able to use the normal echo command to send strings directly to a device, like:

echo "some command" > /dev/usbXXX

To get the output you might be able to just read from it using e.g. cat:

cat /dev/usbXXX | grep "what you're looking for"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top