<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 03/30/2012 01:34 PM, Arnaud Quette wrote:
    <blockquote
cite="mid:CAFm_bUgjXnKbu-2riNxBq5iMTrs+d+6TfhK4Nt8SAQfC=REqLw@mail.gmail.com"
      type="cite"><br>
      <br>
      <div class="gmail_quote">2012/3/29 Joachim Schiele <span
          dir="ltr"><<a moz-do-not-send="true"
            href="mailto:js@lastlog.de">js@lastlog.de</a>></span><br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000">
            <div class="im"> On 03/29/2012 04:24 PM, Arnaud Quette
              wrote:
              <blockquote type="cite"><br>
                <div class="gmail_quote">2012/3/29 Joachim Schiele <span
                    dir="ltr"><<a moz-do-not-send="true"
                      href="mailto:js@lastlog.de" target="_blank">js@lastlog.de</a>></span><br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    hi,<br>
                    <br>
                    i own a aeg protect home (think it is a 600 VA)
                    which has a serial and an usb port.<br>
                    <br>
                    using this hack in ups.conf:<br>
                     [bestupsname]<br>
                          driver = bestups<br>
                          port = /dev/ttyUSB0<br>
                          ID = FOR,750,230,230,11.0,13.5<br>
                          desc = "home-server"<br>
                    <br>
                    i start the driver with:<br>
                     ./bestups -a bestupsname -D -q<br>
                  </blockquote>
                  <div><br>
                    the bestups driver is indeed part of the large "Q1
                    protocol" family:<br>
                    <a moz-do-not-send="true"
href="https://alioth.debian.org/pm/task.php?func=detailtask&project_task_id=493&group_id=30602&group_project_id=318"
                      target="_blank">https://alioth.debian.org/pm/task.php?func=detailtask&project_task_id=493&group_id=30602&group_project_id=318</a><br>
                     </div>
                  <blockquote class="gmail_quote" style="margin:0pt 0pt
                    0pt 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex"> and after adding
                    some debugging it seems to work (not yet in
                    production). i first started by looking at the
                    protocol and it is very very similar to <a
                      moz-do-not-send="true"
                      href="http://www.networkupstols.org/ups-protocols/megatec.html"
                      target="_blank">www.networkupstols.org/ups-protocols/megatec.html</a>
                    at least protocol wise.<br>
                  </blockquote>
                  <div><br>
                    so the way to go is blazer_ser or blazer_usb<br>
                     </div>
                  <blockquote class="gmail_quote" style="margin:0pt 0pt
                    0pt 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex"> but i have a few
                    problems<br>
                    <br>
                    ==== problem 1 ====<br>
                    using FOR is wrong as it then reports as a different
                    device than it actually is. should i add a new
                    device string, say APH?<br>
                    <br>
                    ==== problem 2 ====<br>
                    i would like to use the usb protocol but i don't
                    know where to start.<br>
                    <br>
                    lsusb<br>
                    Bus 003 Device 003: ID 0665:5161 Cypress
                    Semiconductor USB to Serial<br>
                  </blockquote>
                  <div><br>
                    confirming blazer_usb support<br clear="all">
                  </div>
                </div>
              </blockquote>
              <br>
            </div>
            both blazer_ser and blazer_usb seem to work although i had
            some problems as i forgot to run, the command below, with
            the -u root parameter. and because i forgot that i searched
            the wrong thing for quite a while (udev rules):<br>
            <br>
            ./blazer_usb -a blazer_usb -DDD -q<br>
              0.001342     Trying to match device<br>
               0.001348     Device matches<br>
               0.001356     failed to claim USB device: could not claim
            interface 0: Operation not permitted<br>
               0.001363     failed to detach kernel driver from USB
            device: could not detach kernel driver from interface 0:
            Operation not permitted<br>
               0.001370     failed to claim USB device: could not claim
            interface 0: Operation not permitted<br>
               0.001377     failed to detach kernel driver from USB
            device: could not detach kernel driver from interface 0:
            Operation not permitted<br>
               0.001383     failed to claim USB device: could not claim
            interface 0: Operation not permitted<br>
               0.001389     failed to detach kernel driver from USB
            device: could not detach kernel driver from interface 0:
            Operation not permitted<br>
               0.001396     failed to claim USB device: could not claim
            interface 0: Operation not permitted<br>
               0.001402     failed to detach kernel driver from USB
            device: could not detach kernel driver from interface 0:
            Operation not permitted<br>
               0.001408     Can't claim USB device [0665:5161]: could
            not detach kernel driver from interface 0: Operation not
            permitted<br>
            <br>
            but then with -u root it worked:<br>
            <br>
            ./blazer_usb -a blazer_usb -u root -DDD -q<br>
               ...<br>
               0.067478     Trying to match device<br>
               0.067484     Device matches<br>
               0.073450     Trying megatec protocol...<br>
               0.077431     send: Q1<br>
               0.432493     read: (237.2 237.2 233.6 004 49.9 13.5 25.0
            00001001<br>
               0.432574     Status read in 1 tries<br>
               0.432581     Supported UPS detected with megatec protocol<br>
               0.436440     send: F<br>
               0.624780     read: #230.0 002 12.00 50.0<br>
               0.624819     Ratings read in 1 tries<br>
               0.628442     send: I<br>
            <br>
            thanks very much! i wonder if the UPS works with 'just'
            that!</div>
        </blockquote>
        <div><br>
          to be complete enough, still in testing mode:<br>
          - start both the driver and upsd with "-u root"<br>
        </div>
      </div>
    </blockquote>
    here i have some output:<br>
     <a class="moz-txt-link-freetext" href="https://nixos.org/wiki/How_to_setup_UPS/NUT">https://nixos.org/wiki/How_to_setup_UPS/NUT</a><br>
    <blockquote
cite="mid:CAFm_bUgjXnKbu-2riNxBq5iMTrs+d+6TfhK4Nt8SAQfC=REqLw@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">
        <div>- send back a more complete driver output (Ie, the answer
          to "I" is missing above)<br>
        </div>
      </div>
    </blockquote>
    0.000000     debug level is '3'<br>
        0.000614     Checking device (1D6B/0002) (008/001)<br>
        0.000652     - VendorID: 1d6b<br>
        0.000661     - ProductID: 0002<br>
        0.000667     - Manufacturer: Linux 2.6.35.14 ehci_hcd<br>
        0.000674     - Product: EHCI Host Controller<br>
        0.000681     - Serial Number: 0000:00:1d.7<br>
        0.000688     - Bus: 008<br>
        0.000694     Trying to match device<br>
        0.000704     Device does not match - skipping<br>
        0.000714     Checking device (046D/C00C) (006/004)<br>
        0.022891     - VendorID: 046d<br>
        0.022923     - ProductID: c00c<br>
        0.022930     - Manufacturer: Logitech<br>
        0.022937     - Product: USB Mouse<br>
        0.022943     - Serial Number: unknown<br>
        0.022950     - Bus: 006<br>
        0.022956     Trying to match device<br>
        0.022965     Device does not match - skipping<br>
        0.022979     Checking device (04B3/3003) (006/003)<br>
        0.030881     - VendorID: 04b3<br>
        0.030894     - ProductID: 3003<br>
        0.030900     - Manufacturer: Silitek<br>
        0.030907     - Product: IBM USB HUB KEYBOARD<br>
        0.030913     - Serial Number: unknown<br>
        0.030920     - Bus: 006<br>
        0.030926     Trying to match device<br>
        0.030933     Device does not match - skipping<br>
        0.030943     Checking device (04B3/3004) (006/002)<br>
        0.038880     - VendorID: 04b3<br>
        0.038893     - ProductID: 3004<br>
        0.038900     - Manufacturer: Silitek<br>
        0.038906     - Product: IBM USB HUB KEYBOARD<br>
        0.038913     - Serial Number: unknown<br>
        0.038919     - Bus: 006<br>
        0.038926     Trying to match device<br>
        0.038933     Device does not match - skipping<br>
        0.038944     Checking device (1D6B/0001) (006/001)<br>
        0.038973     - VendorID: 1d6b<br>
        0.038981     - ProductID: 0001<br>
        0.038987     - Manufacturer: Linux 2.6.35.14 uhci_hcd<br>
        0.038994     - Product: UHCI Host Controller<br>
        0.039001     - Serial Number: 0000:00:1d.2<br>
        0.039007     - Bus: 006<br>
        0.039014     Trying to match device<br>
        0.039021     Device does not match - skipping<br>
        0.039030     Checking device (1D6B/0001) (005/001)<br>
        0.039054     - VendorID: 1d6b<br>
        0.039062     - ProductID: 0001<br>
        0.039068     - Manufacturer: Linux 2.6.35.14 uhci_hcd<br>
        0.039075     - Product: UHCI Host Controller<br>
        0.039081     - Serial Number: 0000:00:1d.1<br>
        0.039088     - Bus: 005<br>
        0.039094     Trying to match device<br>
        0.039101     Device does not match - skipping<br>
        0.039110     Checking device (1D6B/0001) (004/001)<br>
        0.039134     - VendorID: 1d6b<br>
        0.039141     - ProductID: 0001<br>
        0.039148     - Manufacturer: Linux 2.6.35.14 uhci_hcd<br>
        0.039154     - Product: UHCI Host Controller<br>
        0.039161     - Serial Number: 0000:00:1d.0<br>
        0.039167     - Bus: 004<br>
        0.039174     Trying to match device<br>
        0.039181     Device does not match - skipping<br>
        0.039190     Checking device (0665/5161) (003/002)<br>
        0.066589     - VendorID: 0665<br>
        0.066603     - ProductID: 5161<br>
        0.066609     - Manufacturer: Cypress Semiconductor<br>
        0.066616     - Product: USB to Serial<br>
        0.066623     - Serial Number: unknown<br>
        0.066629     - Bus: 003<br>
        0.066636     Trying to match device<br>
        0.066643     Device matches<br>
        0.072607     Trying megatec protocol...<br>
        0.076590     send: Q1<br>
        0.418407     read: (241.5 241.4 237.5 003 49.9 13.6 25.0
    00001001<br>
        0.418495     Status read in 1 tries<br>
        0.418504     Supported UPS detected with megatec protocol<br>
        0.421595     send: F<br>
        0.610122     read: #230.0 002 12.00 50.0<br>
        0.610149     Ratings read in 1 tries<br>
        0.613598     send: I<br>
        1.615630     read: No error<br>
        1.615664     blazer_vendor: short reply<br>
        1.615672     Vendor information read 1 failed<br>
        1.619619     send: I<br>
        2.621647     read: No error<br>
        2.621682     blazer_vendor: short reply<br>
        2.621690     Vendor information read 2 failed<br>
        2.625638     send: I<br>
        3.627663     read: No error<br>
        3.627683     blazer_vendor: short reply<br>
        3.627690     Vendor information read 3 failed<br>
        3.627697     Vendor information unavailable<br>
        3.627705     Battery runtime will not be calculated (runtimecal
    not set)<br>
        3.631657     send: Q1<br>
        4.002439     read: (241.4 241.4 237.5 004 49.9 13.5 25.0
    00001001<br>
        4.002555     dstate_init: sock
    /var/state/ups/blazer_usb-blazer_usb open on fd 5<br>
        4.005665     send: Q1<br>
        4.354017     read: (241.5 241.4 237.5 004 49.9 13.6 25.0
    00001001<br>
        6.007705     send: Q1<br>
        6.370726     read: (241.5 241.4 237.5 003 49.9 13.6 25.0
    00001001<br>
        8.009741     send: Q1<br>
        8.354691     read: (241.4 241.4 237.5 003 49.9 13.6 25.0
    00001001<br>
       10.010782     send: Q1<br>
       10.370673     read: (241.5 241.4 237.5 004 49.9 13.6 25.0
    00001001<br>
       12.012818     send: Q1<br>
       12.354572     read: (241.4 241.4 237.5 004 49.9 13.6 25.0
    00001001<br>
       14.014859     send: Q1<br>
       14.370553     read: (241.4 241.4 237.5 003 49.9 13.6 25.0
    00001001<br>
       14.974405     Signal 2: exiting<br>
    <blockquote
cite="mid:CAFm_bUgjXnKbu-2riNxBq5iMTrs+d+6TfhK4Nt8SAQfC=REqLw@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">
        <div>
          - send back outputs from upsc / upsrw / upscmd<br>
        </div>
      </div>
    </blockquote>
     <br>
     # upsc ProtectHome@localhost        <br>
     battery.voltage: 13.60<br>
     battery.voltage.nominal: 12.0<br>
     beeper.status: enabled<br>
     device.type: ups<br>
     driver.name: blazer_usb<br>
     driver.parameter.pollinterval: 2<br>
     driver.parameter.port: /dev/hidraw_protecthome<br>
     driver.version: 2.6.1<br>
     driver.version.internal: 0.03<br>
     input.current.nominal: 2.0<br>
     input.frequency: 49.9<br>
     input.frequency.nominal: 50<br>
     input.voltage: 241.4<br>
     input.voltage.fault: 241.4<br>
     input.voltage.nominal: 230<br>
     output.voltage: 237.5<br>
     ups.delay.shutdown: 30<br>
     ups.delay.start: 180<br>
     ups.load: 4<br>
     ups.productid: 5161<br>
     ups.status: OL<br>
     ups.temperature: 25.0<br>
     ups.type: offline / line interactive<br>
     ups.vendorid: 0665<br>
     <br>
     don't know what to test with upsrw or upscmd <br>
     <br>
     upsrw -u master -s beeper.status=on ProtectHome@localhost<br>
     Unexpected response from upsd: ERR ACCESS-DENIED<br>
    <blockquote
cite="mid:CAFm_bUgjXnKbu-2riNxBq5iMTrs+d+6TfhK4Nt8SAQfC=REqLw@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">
        <div>- test the shutdown using (requires upsmon to be started
          too, as root):<br>
          <a moz-do-not-send="true"
href="http://www.networkupstools.org/docs/user-manual.chunked/ar01s06.html#UPS_shutdown">http://www.networkupstools.org/docs/user-manual.chunked/ar01s06.html#UPS_shutdown</a>
          <br>
        </div>
      </div>
      <br>
    </blockquote>
    as configured the system was shut down within 25seconds after UPS
    was disconnected from power, see also:<br>
<a class="moz-txt-link-freetext" href="https://nixos.org/wiki/How_to_setup_UPS/NUT#example_log.2C_when_unplugging_the_UPS_from_power">https://nixos.org/wiki/How_to_setup_UPS/NUT#example_log.2C_when_unplugging_the_UPS_from_power</a><br>
     <br>
    the driver seems to work here as this is exactly what i wanted. when
    battery takes over, shutdown the system after 25seconds. this leaves
    enough time to replug the power wires if needed but ensured that the
    system goes down as soon as possible.<br>
     <br>
    <blockquote
cite="mid:CAFm_bUgjXnKbu-2riNxBq5iMTrs+d+6TfhK4Nt8SAQfC=REqLw@mail.gmail.com"
      type="cite">I'm holding the commit of a new hardware compat list
      entry until you send these back<br>
    </blockquote>
    yeah, thanks for that!<br>
    <blockquote
cite="mid:CAFm_bUgjXnKbu-2riNxBq5iMTrs+d+6TfhK4Nt8SAQfC=REqLw@mail.gmail.com"
      type="cite">cheers,<br clear="all">
      Arnaud<br>
      -- <br>
      Linux / Unix Expert R&D - Eaton - <a moz-do-not-send="true"
        href="http://powerquality.eaton.com" target="_blank">http://powerquality.eaton.com</a><br>
      Network UPS Tools (NUT) Project Leader - <a
        moz-do-not-send="true" href="http://www.networkupstools.org/"
        target="_blank">http://www.networkupstools.org/</a><br>
      Debian Developer - <a moz-do-not-send="true"
        href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>
      Free Software Developer - <a moz-do-not-send="true"
        href="http://arnaud.quette.free.fr/" target="_blank">http://arnaud.quette.free.fr/</a><br>
      <br>
    </blockquote>
    <br>
  </body>
</html>