1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Control APC UPS from Router

Discussion in 'Tomato Firmware' started by arrmo, Aug 7, 2011.

  1. arrmo

    arrmo LI Guru Member

    Hi,

    My router hangs off an APC UPS, which has a USB interface - so I would like to be able to monitor and control the UPS from my router (similar to what is being done here ... http://www.dd-wrt.com/phpBB2/viewtopic.php?t=65676).

    However, I don't seem to have the right drivers - or at least I don't seem to recognize the USB UPS. I have built apcupsd, and it runs on my (Toastman) based router, but it complains about missing drivers. I have built the latest Toastman-RT release, and tried to load the hid.ko driver on the router, but this also fails.

    The alternative I considered was to get opkg installed on the router, as there is a package out there for apcupsd, but I will still be missing the driver ... :(.

    Has anyone successfully done this? Any suggestions?

    Thanks!

    ... Russell
     
  2. Toxic

    Toxic Administrator Staff Member

  3. arrmo

    arrmo LI Guru Member

    Hi,

    This makes sense - and may be a better client ... but the USB driver seems to be my biggest sticking point. The router doesn't seem to be recognizing that anything is connected (no hid driver?). Any thoughts how to fix that issue?

    Thanks!

    ... Russell
     
  4. arrmo

    arrmo LI Guru Member

    Hi,

    Not so lonely that I'm replying to myself, but trying to keep others in the loop ... :).

    I checked, and the kernel seems to be configured for hiddev support - but it really doesn't seem to be there. Any thoughts?

    Thanks,
    ... Russell
     
  5. Toxic

    Toxic Administrator Staff Member

  6. arrmo

    arrmo LI Guru Member

    Hi,

    It may be, I'm not positive (and not an expert) ... :-(. This seems to expect the kernel module / driver to be in place, no? My issue is that I don't seem to see the kernel driver, even though it seems to be enabled in the kernel build (i.e. make menuconfig).

    I may be missing your point though - sorry!

    ... Russell
     
  7. arrmo

    arrmo LI Guru Member

    Hi,

    OK, I have this working - and the info is below, to hopefully help other folks out if they want to do this. Basically, I added a few lines to the top level Makefile (attached below), along with a new variable to enable / disable this (disabled by default) - then some kernel modules are enabled / installed. The corresponding modules are not copied to the router by default (removed by router makefile), so these changes are needed for the UPS to be recognized (built these items in to the actual kernel). Then "normal" apcupsd works fine (and can be installed via optware if desired).

    if [ "$(UPS)" = "y" ]; then \
    sed -i "/CONFIG_INPUT=m/d" $(1); \
    echo "CONFIG_INPUT=y" >>$(1); \
    sed -i "/CONFIG_USB=m/d" $(1); \
    echo "CONFIG_USB=y" >>$(1); \
    sed -i "/CONFIG_HID=m/d" $(1); \
    echo "CONFIG_HID=y" >>$(1); \
    sed -i "/CONFIG_USB_HID=m/d" $(1); \
    echo "CONFIG_USB_HID=y" >>$(1); \
    sed -i "/CONFIG_USB_HIDDEV=m/d" $(1); \
    echo "CONFIG_USB_HIDDEV=y" >>$(1); \
    sed -i "/CONFIG_USB_DEVICEFS=m/d" $(1); \
    echo "CONFIG_USB_DEVICEFS=y" >>$(1); \
    fi; \

    Yell if you have any questions!

    ... Russell
     
  8. motocrossmann

    motocrossmann Network Guru Member

    Resurrecting this old thread in hopes that arrmo is still around... I'm trying the same thing with a DDWRT k26 build. I have the apc daemon loaded, and installed "drivers" from here http://www.dd-wrt.com/phpBB2/viewtopic.php?t=65676 see HID.zip toward the bottom. The problem is that DDWRT still does not "see" the HID drivers. I can confirm this by running "ls -l /sys/bus/usb/drivers/". No HID drivers appear?!? What to do from here???
     
  9. arrmo

    arrmo LI Guru Member

    Yep, still here ... ;-). Hopefully can help out!

    When you check the logs (dmesg), do you see the device being recognized. And is USB1.1 turned on? Going from memory here (from a long time back), but I recall having to turn USB1.1 on.
     
  10. motocrossmann

    motocrossmann Network Guru Member

    Cool. Thanks arrmo! I managed to get the daemon up and working. I was either not running insmod with the -f switch, or I had to change the permissions on the *.ko files. I'm not exactly sure what did it.

    Next is jiggering up some sort of email notification system for a dying battery and setting up a shutdown when the battery gets low...
     
  11. arrmo

    arrmo LI Guru Member

    Glad to hear it! I did post some information about how to set this up with startup scripts - have you found / tried that?
     

Share This Page