Hi Chris,
I am cc'ing this to the nut-upsuser mailing list.
Chris Hotte wrote:>
> Hello Peter! First of all, allow me to thank you in advance for all the
> work and information you have assembled on UPS devices.
>
> I'm currently (not a pun) investigating UPS solutions for my Linux
based
> server. The summer has hit and were getting a lot of brownouts. I would
> like to get a 900VA box that can handle both my Linux box and windows
> box and single display together.
>
>
http://www.canadacomputers.com/index.php?do=ShowProduct&cmd=pd&pid=010761&cid=PS.643
>
> I'm wondering if the USB can be run through a hub and used with both
> computers. I kicked around the web for a bit and found no mention of
> this being tried.
Unlike Ethernet, USB is not a symmetric protocol. You can have hubs,
but each hub can only have a single "uplink" and multiple
"downlinks". By definition, computers are "up" and devices
are
"down", so you can connect an (almost) unlimited number of devices to
a single computer, but not multiple computers to a single device. So
as far as I know, what you suggest cannot be done with USB.
However, it is not really necessary to drive the USB from both
computers. For starters, you can use the USB without any driver, and
this will bridge short and medium-length blackouts and brownouts
without any need to shut down the operating system. The purpose of the
driver is only to shut down the computer cleanly just before the
battery runs out.
Also, NUT allows computers to listen to shutdown requests from drivers
that run on other computers. Thus, the computer that has the USB
attached is the "master", and the others are "slaves" that
receive
notifications of critical events. This is done via ordinary network
sockets (i.e., TCP/IP). However, I don't know how this works with a
Windows machine. Someone on this list might know.
> Does the daemon poll the UPS periodically to determine status?
> Alternatively, does the driver set up an interrupt vector for the UPS to
> call the daemon? The second approach makes more sense in terms of the
> cost of polling air, but has the downside of breaking any possibility of
> my envisioned two computer setup.
As far as I know, both can happen and do happen within the NUT
newhidups driver. Not all UPS devices are well-engineered, and some
don't support interrupt pipelines correctly. In any case, if you're
not a driver writer, chances are this will make little difference to
you. The overhead in doing a poll every 5 seconds or so is minimal.
> I've done no USB programming so I
> don't know if this is even feasible within the domain of the USB
> protocol. Is the USB broadcast or is it coded with a device id
> destination like IP?
Neither, actually. A USB device is accessed, at the protocol level, as
a physical path, for example, "the 3rd device on the hub which is the
2nd device on the hub which is the 4th device on the root hub which is
on the 4th controller...". The operating system usually provides an
abstraction so that you (and the driver) don't actually need to see
this mess. -- Peter
> Questions, questions, questions. *laugh*
>
>
> Thanks for any answer you might have,
>
> - Chris.