[Nut-upsdev] megatec over USB - new driver patch

Arjen de Korte
Tue, 05 Dec 2006 15:57:03 -0000

>      I just dont want the results of my work to disappear into void. Is
> it something that can go into main tree? Please let me know what you
> think. I can also do all the grunt work (write man page, add to a list
> of supported devices, change debian USB hotplug script, etc) if this
> driver will be included. Thanks.

Your effort to support this UPS are appreciated. The only remark I want to
make, is that I don't think it is needed to change the present megatec
driver and preferably, I would refrain from doing so. The only thing
needed, is a new serial_usb.c that provides (a subset of) the standard
serial I/O functions with the same name. Just ignore the parameters that
are not used and provide stubs for the functions not implemented. With a
bit of luck, we might be able to reuse that for other UPS'es that use
similar hardware, but speak a different protocol. Then at link time you
can decide whether to use the serial.o or serial_usb.o object to decide
for what kind of interface you're building. The only issue that remains
now, is that the driver should report at startup which version it is. This
can be handled nicely by using the value of 'progname' in the
upsdrv_banner() function in the megatec.c file. Yesterday I committed a
change to make the value of this parameter available at the time
upsdrv_banner() is called.

Best regards, Arjen
--
Eindhoven - The Netherlands
Key fingerprint - 66 4E 03 2C 9D B5 CB 9B  7A FE 7E C1 EE 88 BC 57