Révision b85c9aec
arris-sb6183: Fix int32 wrapping in WebUI
When error counts wrap they are displayed as int32 and negative.
Recast them to uint32 to fix math.
Signed-off-by: Nathaniel Clark <Nathaniel.Clark@misrule.us>
| plugins/router/arris-sb6183 | ||
|---|---|---|
| 80 | 80 |
import re |
| 81 | 81 |
import os |
| 82 | 82 |
import sys |
| 83 |
import ctypes |
|
| 83 | 84 |
from urllib import request |
| 84 | 85 |
|
| 86 |
def fixint(i): |
|
| 87 |
return ctypes.c_uint32(int(i)).value |
|
| 88 |
|
|
| 85 | 89 |
HOSTNAME = os.getenv("hostname", None)
|
| 86 | 90 |
STATUS_URL = "http://192.168.100.1/RgConnect.asp" |
| 87 | 91 |
INFO_URL = "http://192.168.100.1/RgSwInfo.asp" |
| ... | ... | |
| 293 | 297 |
data = dict( |
| 294 | 298 |
zip(headings, ["".join(x.itertext()).strip() for x in row.findall("td")])
|
| 295 | 299 |
) |
| 296 |
uncorr += int(data["Uncorrectables"]) |
|
| 297 |
correct += int(data["Corrected"]) |
|
| 300 |
uncorr += fixint(data["Uncorrectables"])
|
|
| 301 |
correct += fixint(data["Corrected"])
|
|
| 298 | 302 |
|
| 299 |
channel = int(data["Channel"]) |
|
| 303 |
channel = fixint(data["Channel"])
|
|
| 300 | 304 |
|
| 301 | 305 |
print("\nmultigraph arris_power.down_{0}".format(channel))
|
| 302 | 306 |
value = data["Power"].split(" ")[0]
|
| ... | ... | |
| 309 | 313 |
snr[channel - 1] = value |
| 310 | 314 |
|
| 311 | 315 |
print("multigraph arris_error.down_{0}".format(channel))
|
| 312 |
print("corr.value {0}".format(data["Corrected"]))
|
|
| 313 |
print("uncr.value {0}".format(data["Uncorrectables"]))
|
|
| 316 |
print("corr.value {0}".format(fixint(data["Corrected"])))
|
|
| 317 |
print("uncr.value {0}".format(fixint(data["Uncorrectables"])))
|
|
| 314 | 318 |
|
| 315 | 319 |
# Fill missing |
| 316 | 320 |
for i in range(len(trs), DOWNCOUNT): |
| ... | ... | |
| 349 | 353 |
data = dict( |
| 350 | 354 |
zip(headings, ["".join(x.itertext()).strip() for x in row.findall("td")])
|
| 351 | 355 |
) |
| 352 |
channel = int(data["Channel"]) |
|
| 356 |
channel = fixint(data["Channel"])
|
|
| 353 | 357 |
print("multigraph arris_power.up_{0}".format(channel))
|
| 354 | 358 |
value = data["Power"].split(" ")[0]
|
| 355 | 359 |
print("power.value {0}".format(value))
|
Formats disponibles : Unified diff