janh / go-dsl

Library and application for reading xDSL stats
Mozilla Public License 2.0
31 stars 2 forks source link

Quirks for ALLNET ALL-BM300 #16

Open plush opened 5 months ago

plush commented 5 months ago

I was able to get go-dsl working with my ALLNET ALL-BM300 modem after applying some quirks. I don't have a straight up patch because some of the quirks go beyond what go-dsl does right now, and others conflict with some of its assumptions. Here is what I had to do:

  1. Once accessed by telnet (192.168.16.254, user admin, password admin), the command prompt ends in $, not # (lantiq/telnet.go line 37).
  2. The command is found at /opt/opt/intel/bin/dsl_pipe, but it's owned by dsl:dslgrp with permissions 110, so user admin cannot run it. Fortunately, sudo is available. I didn't want to mess with the original binary via overlayfs and simply copied it to /tmp/dslpipe (there was an unrelated file called /tmp/dsl_pipe there already), then changed its permissions to 755.
  3. When run as user admin, the command fails because it has no write access to /tmp/pipe/dms_0_cmd. I changed this file's permissions to 777 and go-dsl was finally able to read data.
  4. The modem reports API version 5.5.21 and did not understand most commands sent by go-dsl. Treating it as legacy (lantiq/data.go, line 137) helped and made more data appear.
  5. I was able to add the following commandLegacy entries in lantiq/data.go to get more data:
    LineFeatureStatus_US         dataItem `command:"lfsg 0" commandLegacy:"lfsg 0 0"`
    LineFeatureStatus_DS         dataItem `command:"lfsg 1" commandLegacy:"lfsg 0 1"`
    G997_RateAdaptationStatus_US dataItem `command:"g997rasg 0" commandLegacy:"g997rasg 0 0"`
    G997_RateAdaptationStatus_DS dataItem `command:"g997rasg 1" commandLegacy:"g997rasg 0 1"`
    BandBorderStatus_US           dataItem `command:"bbsg 0" commandLegacy:"bbsg 0 0"`
    BandBorderStatus_DS           dataItem `command:"bbsg 1" commandLegacy:"bbsg 0 1"`
  6. I also had to change one of the commandLegacy entries for my modem:
    G997_XTUSystemEnablingStatus dataItem `command:"g997xtusesg" commandLegacy:"g997xtusesg 0"`
  7. Finally, for the line state, lantiq/status.go checks for a 0x prefix on the state code in line 235, but only to strip it, not to distinguish between hex and decimal numbers. This is wrong for my modem. The code has no 0x prefix and it isn't hex, but decimal. Decoding it as such in line 239 gave me the correct line state.
janh commented 4 months ago

Thank you for the report and sorry for the late response.

Adding proper support for the newer API version should be possible, but I need more data. If you can find out the working commands and send them to me including the full output, I'll look into it.

About the first three points: Allowing the $ prompt should not be an issue. If I understand correctly, the other two steps can be done manually by the user, right?