Dazed and confused, but trying to continue 🇵🇱/🏴󠁧󠁢󠁥󠁮󠁧󠁿/🇷🇺 ⚧ they

Maintains homie/hoe stasis. Store horizontally when not in use. Contains sulfites.


   #!/bin/sh    base=.1.3.6.1.4.1.8072.9999.9999.1    get() {        case "${get#$base}" in            .0)                echo $get                echo STRING                echo hello world                ;;           .1)               echo $get               echo INTEGER               echo 8675309               ;;           *)               echo NONE               ;;       esac   }   while :; do       read -r op       case "$op" in           get)               read -r get               echo "get $get (${get#$base})" | logger               get               ;;           getnext)               read -r get               echo "getnext $get (${get#$base})" | logger               case "${get#$base}" in                   .0)                       get=$base.1                       get                       ;;                   .1)                       echo NONE                       ;;                   *)                       get=$base.0                       get                       ;;               esac               ;;           set)               read -r val               echo "set $val" | logger               echo not-writable               ;;           PING)               echo PONG               ;;           *)               echo "HUH $op" | logger               ;;       esac   done  $ snmpwalk  -v1 -c public localhost .1.3.6.1.4.1.8072.9999.9999 NET-SNMP-MIB::netSnmpPlaypen.1.0 = STRING: "hello world" NET-SNMP-MIB::netSnmpPlaypen.1.1 = INTEGER: 8675309 Feb 08 02:50:04 tarta Debian-snmp[2678083]: getnext .1.3.6.1.4.1.8072.9999.9999.1 () Feb 08 02:50:04 tarta Debian-snmp[2678085]: getnext .1.3.6.1.4.1.8072.9999.9999.1.0 (.0) Feb 08 02:50:04 tarta Debian-snmp[2678087]: getnext .1.3.6.1.4.1.8072.9999.9999.1.1 (.1)

the most shocking part is i might have a usecase for this


the active energy field is pretty sussy but it's just a 4-byte integer sucked off as 2 2-byte ones, $ printf '%4s\n' $(printf '%s\n' obase=16 58932 60 | bc) | tr ' ' 0 | tac | paste -sd\\0 | bc
399634
and that's what the LCD shows too


SNMPv2-MIB::snmpSilentDrops.0 = Counter32: 0 SNMPv2-MIB::snmpProxyDrops.0 = Counter32: 0 HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (124201485) 14 days, 9:00:14.85 HOST-RESOURCES-MIB::hrSystemDate.0 = STRING: 2023-2-9,16:17:23.0,+1:0 HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0 = INTEGER: 393216 HOST-RESOURCES-MIB::hrSystemInitialLoadParameters.0 = STRING: "BOOT_IMAGE=/@/vmlinuz-5.10.0-20-amd64 ro root=zfs:AUTO mce=dont_log_ce intel_iommu=on zfs.zfs_arc_max=96636764160 zfs.zfs_arc_lo" HOST-RESOURCES-MIB::hrSystemNumUsers.0 = Gauge32: 3 HOST-RESOURCES-MIB::hrSystemProcesses.0 = Gauge32: 0 HOST-RESOURCES-MIB::hrSystemMaxProcesses.0 = INTEGER: 0 ORNO-MIB::ornoOrWe504DeviceIndex.1 = INTEGER: 1 ORNO-MIB::ornoOrWe504Voltage.1 = INTEGER: 6.4 V ORNO-MIB::ornoOrWe504Current.1 = INTEGER: 6.5 A ORNO-MIB::ornoOrWe504Frequency.1 = INTEGER: 6.6 Hz ORNO-MIB::ornoOrWe504ActivePower.1 = INTEGER: 67 W ORNO-MIB::ornoOrWe504ReactivePower.1 = INTEGER: 68 VAr ORNO-MIB::ornoOrWe504ApparentPower.1 = INTEGER: 69 VA ORNO-MIB::ornoOrWe504PowerFactor.1 = INTEGER: .070 ORNO-MIB::ornoOrWe504TotalEnergy.1 = INTEGER: 71 Wh ORNO-MIB::ornoOrWe504DeviceIndex.2 = INTEGER: 2 ORNO-MIB::ornoOrWe504Voltage.2 = INTEGER: 7.2 V ORNO-MIB::ornoOrWe504Current.2 = INTEGER: 7.3 A ORNO-MIB::ornoOrWe504Frequency.2 = INTEGER: 7.4 Hz ORNO-MIB::ornoOrWe504ActivePower.2 = INTEGER: 75 W ORNO-MIB::ornoOrWe504ReactivePower.2 = INTEGER: 76 VAr ORNO-MIB::ornoOrWe504ApparentPower.2 = INTEGER: 77 VA ORNO-MIB::ornoOrWe504PowerFactor.2 = INTEGER: .078 ORNO-MIB::ornoOrWe504TotalEnergy.2 = INTEGER: 79 Wh End of MIB $ #snmpwalk -Cc   localhost .1 $ snmptranslate    .iso.org.dod.internet.private.enterprises.orno -Tp +--orno(69)    |    +--ornoMIB(0)    |    +--ornoWe504Table(504)    |  |    |  +--ornoOrWe504Entry(0)    |     |  Index: ornoOrWe504DeviceIndex    |     |    |     +-- -R-- Integer32 ornoOrWe504DeviceIndex(0)    |     |        Range: 1..255    |     +-- -R-- Integer32 ornoOrWe504Voltage(1)    |     |        Textual Convention: Tenths    |     +-- -R-- Integer32 ornoOrWe504Current(2)    |     |        Textual Convention: Tenths    |     +-- -R-- Integer32 ornoOrWe504Frequency(3)    |     |        Textual Convention: Tenths    |     +-- -R-- Integer32 ornoOrWe504ActivePower(4)    |     +-- -R-- Integer32 ornoOrWe504ReactivePower(5)    |     +-- -R-- Integer32 ornoOrWe504ApparentPower(6)    |     +-- -R-- Integer32 ornoOrWe504PowerFactor(7)    |     |        Textual Convention: Thousandths    |     +-- -R-- Integer32 ornoOrWe504TotalEnergy(8)    |    +--ornoWe505Table(505)       |       +--ornoOrWe505Entry(0)          |  Index: ornoOrWe505DeviceIndex          |          +-- -R-- Integer32 ornoOrWe505DeviceIndex(0)          +-- -R-- TimeTicks ornoOrWe505Update(1)          |        Textual Convention: TimeStamp          +-- -R-- TimeTicks ornoOrWe505Since(2)          |        Textual Convention: TimeStamp          +-- -R-- Integer32 ornoOrWe505Energy(3)

sysv message queues? kinda slick with it; world's most insane interface, natch, but

also thanks to @ThePhD's n3030 i can have enum or_we_504_msgtype : long { in c and c++ with -std=c2x, which makes this much less insane


and yes the raw format is 3c 00 0f f5 for 3`994`895 (0x003cf50f), so two LSB u16s pasted together MSBly, which is PDP-11 middle-endian. plus ça change


falling edge trigger feasible if i manage to talk to the GPIO

also lol the integration time on this meter really fucks it, mathematically it comes out to 1mA, i measured 848μA with a jumper


in that you need to broadcast the address change, not just send it, and they explicitly say to send it to the device

hey, guess what doesn't work in modern mbpoll, that i remember glancing through when initially trying to connect…

Some RTU devices need to get initialized to a certain address via the 0x00 broadcast address. But currently RTU_SLAVEADDR_MIN is defined as 1

lol. lmfao.


and i cant "emulate" the meter well enough by just reading from the USB/serial adapter

so i snapshotted the entire pool on my laptop and installed wine32 and mono and ms fonts and deleted my wine config because it wouldnt load


i cannot get it to work regardless of the arcana i do and how i torture it, despite posting the same data as the configger; i think its because of modbus's explicit precise inter-byte (inter-message? both?) sleeps that libmodbus boasts about not having

itll be in Attic/ for posterity but for my usecase i can just set the addresses and serials once manually :v


$ make clean rm -f ORNO-OR-WE-504-modbus ORNO-OR-WE-505-gpio ORNO-OR-WE-504-snmp ORNO-OR-WE-505-snmp ORNO-OR-WE-dumpy $ make -j cc -std=c2x -I/usr/include/modbus  -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -g -Wall -Wextra -flto=full -fuse-ld=lld -Wl,--as-needed -lrt -latomic -lmodbus   ORNO-OR-WE-504-modbus.c   -o ORNO-OR-WE-504-modbus cc -std=c2x -I/usr/include/modbus  -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -g -Wall -Wextra -flto=full -fuse-ld=lld -Wl,--as-needed -lrt -latomic -lmodbus   ORNO-OR-WE-505-gpio.c   -o ORNO-OR-WE-505-gpio c++ -std=c++20 -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -g -Wall -Wextra -flto=full -fuse-ld=lld -Wl,--as-needed -lrt -latomic -lmodbus   ORNO-OR-WE-504-snmp.cpp   -o ORNO-OR-WE-504-snmp c++ -std=c++20 -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -g -Wall -Wextra -flto=full -fuse-ld=lld -Wl,--as-needed -lrt -latomic -lmodbus   ORNO-OR-WE-505-snmp.cpp   -o ORNO-OR-WE-505-snmp cp ORNO-OR-WE-dumpy.sh ORNO-OR-WE-dumpy $ file ORNO-OR-WE-504-modbus ORNO-OR-WE-505-gpio ORNO-OR-WE-504-snmp ORNO-OR-WE-505-snmp ORNO-OR-WE-dumpy ORNO-OR-WE-504-modbus: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[xxHash]=a58765009c288441, with debug_info, not stripped ORNO-OR-WE-505-gpio:   ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[xxHash]=dff6cd7a988f007d, with debug_info, not stripped ORNO-OR-WE-504-snmp:   ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[xxHash]=1c805d687f14be15, with debug_info, not stripped ORNO-OR-WE-505-snmp:   ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[xxHash]=42917d88e82d6e4d, with debug_info, not stripped ORNO-OR-WE-dumpy:      POSIX shell script, ASCII text executable $ make clean rm -f ORNO-OR-WE-504-modbus ORNO-OR-WE-505-gpio ORNO-OR-WE-504-snmp ORNO-OR-WE-505-snmp ORNO-OR-WE-dumpy $ $ CPPFLAGS="-target arm-linux-gnueabi -Wno-atomic-alignment -Wno-unaligned-access" LDFLAGS=-L. make -j cc -std=c2x -I/usr/include/modbus  -target arm-linux-gnueabi -Wno-atomic-alignment -Wno-unaligned-access -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -g -Wall -Wextra -L. -flto=full -fuse-ld=lld -Wl,--as-needed -lrt -latomic -lmodbus   ORNO-OR-WE-504-modbus.c   -o ORNO-OR-WE-504-modbus cc -std=c2x -I/usr/include/modbus  -target arm-linux-gnueabi -Wno-atomic-alignment -Wno-unaligned-access -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -g -Wall -Wextra -L. -flto=full -fuse-ld=lld -Wl,--as-needed -lrt -latomic -lmodbus   ORNO-OR-WE-505-gpio.c   -o ORNO-OR-WE-505-gpio c++ -std=c++20 -target arm-linux-gnueabi -Wno-atomic-alignment -Wno-unaligned-access -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -g -Wall -Wextra -L. -flto=full -fuse-ld=lld -Wl,--as-needed -lrt -latomic -lmodbus   ORNO-OR-WE-504-snmp.cpp   -o ORNO-OR-WE-504-snmp c++ -std=c++20 -target arm-linux-gnueabi -Wno-atomic-alignment -Wno-unaligned-access -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -g -Wall -Wextra -L. -flto=full -fuse-ld=lld -Wl,--as-needed -lrt -latomic -lmodbus   ORNO-OR-WE-505-snmp.cpp   -o ORNO-OR-WE-505-snmp cp ORNO-OR-WE-dumpy.sh ORNO-OR-WE-dumpy $ file ORNO-OR-WE-504-modbus ORNO-OR-WE-505-gpio ORNO-OR-WE-504-snmp ORNO-OR-WE-505-snmp ORNO-OR-WE-dumpy ORNO-OR-WE-504-modbus: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, BuildID[xxHash]=44fdf79bc38c0196, with debug_info, not stripped ORNO-OR-WE-505-gpio:   ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, BuildID[xxHash]=74c95938f997db5b, with debug_info, not stripped ORNO-OR-WE-504-snmp:   ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, BuildID[xxHash]=65f435484ede0393, with debug_info, not stripped ORNO-OR-WE-505-snmp:   ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, BuildID[xxHash]=e7cf566d96f8f12d, with debug_info, not stripped ORNO-OR-WE-dumpy:      POSIX shell script, ASCII text executable

(the -L. is for libmodbus, im not installing armel-native packages just for this)

i also dont think i posted the shart link, if you also have some polish leccy meters (though I suspect the impulse driver will be relatively universal):


as in: you just say what you want in GPIO_V2_GET_LINE_IOCTL, that gives you an fd to read, you sleep in read, and it's pre-timestamped. i cannot get over the usability of this


and theres drip mode as well:

(idk how well this comes out, the blinks are short and i have no explicit control over the frame integration time)


ciastko-malinowe:~$ free -h                total        used        free      shared  buff/cache   available Mem:           432Mi        33Mi       266Mi       5.0Mi       132Mi       383Mi Swap:             0B          0B          0B ciastko-malinowe:~$ logout Connection to ciastko-malinowe closed. tarta:~$ free -h                total        used        free      shared  buff/cache   available Mem:            94Gi        73Gi        18Gi       1.3Gi       2.9Gi        18Gi Swap:          8.0Gi        32Mi       8.0Gi

i gamed down the golden image rootfs to 324M used too, which is ~acceptable when keeping all modules and firmware i think


nabijaczleweli@ciastko-malinowe:~$ systemctl status dupa@'5\x206' ORNO-OR-WE-504-modbus@ttyUSB0.service snmpd ● dupa@5\x206.service - 5\x206 test 5 6      Loaded: loaded (/run/systemd/system/dupa@.service; static)      Active: active (running) since Mon 2023-02-13 21:22:55 CET; 24h ago    Main PID: 3444 (ORNO-OR-WE-505-)       Tasks: 1 (limit: 853)      Memory: 148.0K         CPU: 7.764s      CGroup: /system.slice/system-dupa.slice/dupa@5\x206.service              └─3444 /usr/local/sbin/ORNO-OR-WE-505-gpio /ORNO505 5 6  Feb 13 21:22:55 ciastko-malinowe systemd[1]: Started 5\x206 test 5 6. Feb 13 21:22:55 ciastko-malinowe sh[3444]: gpiochip0: pinctrl-bcm2835 w/54 lines Feb 13 21:22:55 ciastko-malinowe sh[3444]: meter 0: line 5: GPIO5 Feb 13 21:22:55 ciastko-malinowe sh[3444]: meter 1: line 6: GPIO6  ● ORNO-OR-WE-504-modbus@ttyUSB0.service - Scrape ORNO OR-WE-504 meters over modbus on device ttyUSB0      Loaded: loaded (/usr/local/lib/systemd/system/ORNO-OR-WE-504-modbus@.service; enabled; vendor preset: enabled)     Drop-In: /run/systemd/system/ORNO-OR-WE-504-modbus@.service.d              └─upa.conf      Active: active (running) since Mon 2023-02-13 21:22:55 CET; 24h ago    Main PID: 3443 (ORNO-OR-WE-504-)       Tasks: 1 (limit: 853)      Memory: 96.0K         CPU: 13.530s      CGroup: /system.slice/system-ORNO\x2dOR\x2dWE\x2d504\x2dmodbus.slice/ORNO-OR-WE-504-modbus@ttyUSB0.service              └─3443 /usr/local/sbin/ORNO-OR-WE-504-modbus /dev/ttyUSB0  Feb 13 21:22:55 ciastko-malinowe systemd[1]: Started Scrape ORNO OR-WE-504 meters over modbus on device ttyUSB0.  ● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.      Loaded: loaded (/lib/systemd/system/snmpd.service; enabled; vendor preset: enabled)     Drop-In: /etc/systemd/system/snmpd.service.d              └─override.conf      Active: active (running) since Mon 2023-02-13 21:22:55 CET; 24h ago     Process: 3445 ExecStartPre=/bin/mkdir -p /var/run/agentx (code=exited, status=0/SUCCESS)    Main PID: 3448 (snmpd)       Tasks: 3 (limit: 853)      Memory: 1.4M         CPU: 3min 5.084s      CGroup: /system.slice/snmpd.service              ├─3448 /usr/sbin/snmpd -LOw -u Debian-snmp -g Debian-snmp -I system_mib snmp_mib hr_system hw_sensors pass_persist extend -f -p /run/snmpd.pid              ├─3449 /usr/local/libexec/ORNO-OR-WE-505-snmp /ORNO505              └─3453 /usr/local/libexec/ORNO-OR-WE-504-snmp /dev/ttyUSB0  Feb 13 21:22:55 ciastko-malinowe systemd[1]: Starting Simple Network Management Protocol (SNMP) Daemon.... Feb 13 21:22:55 ciastko-malinowe systemd[1]: Started Simple Network Management Protocol (SNMP) Daemon.. Feb 13 21:22:56 ciastko-malinowe snmpd[3448]: Cannot rename /var/lib/snmp/snmpd.conf to /var/lib/snmp/snmpd.0.conf Feb 13 21:22:56 ciastko-malinowe snmpd[3448]: Cannot unlink /var/lib/snmp/snmpd.conf Feb 13 21:22:56 ciastko-malinowe snmpd[3448]: read_config_store open failure on /var/lib/snmp/snmpd.conf Feb 13 21:22:56 ciastko-malinowe snmpd[3448]: read_config_store open failure on /var/lib/snmp/snmpd.conf Feb 13 21:22:56 ciastko-malinowe snmpd[3448]: read_config_store open failure on /var/lib/snmp/snmpd.conf

with 1/min polling of ORNO-MIB::orno, as is the expected real-world condition


/usr/local/lib/udev/rules.d/99-ORNO.rules with SUBSYSTEM=="gpio", TAG+="systemd" does its magic, though, admittedly, this is largely frivolous on a coldplugged device


and i need a resistor Somewhere to trigger the usb host, too bad the raspberry pi is entirely undocumented so i dont have a fucking clue where, if at all, the Special Pin is available


and I/O works, even! well, just O, i guess, havent gotten a response from the meter


where "intermittent" means it just worked for 16h straight, but then it didnt after i rebooted for new device tree and jiggled it around, but then it worked once, and im guessing this shit would

too bad i noticed after i cut off the wires in preparation to solder them to the second, working adapter. turned a 20 second job into a 7-minute one, and instead of the incredible strain relief system™ it will now be a squeeze of cum


$ dtdiff ~/uwu/p16/boot/firmware/bcm2835-rpi-zero-w.dtb{.orig,}
--- /dev/fd/63  2023-02-26 21:57:08.472157491 +0100
+++ /dev/fd/62  2023-02-26 21:57:08.472157491 +0100
@@ -681,10 +681,7 @@
                        clock-names = "otg";
                        clocks = <0x16>;
                        compatible = "brcm,bcm2835-usb";
-                       dr_mode = "otg";
-                       g-np-tx-fifo-size = <0x20>;
-                       g-rx-fifo-size = <0x100>;
-                       g-tx-fifo-size = <0x100 0x100 0x200 0x200 0x200 0x300 0x300>;
+                       dr_mode = "host";
                        interrupts = <0x01 0x09>;
                        phy-names = "usb2-phy";
                        phys = <0x17>;


You must log in to comment.

in reply to @nabijaczleweli's post:

idk, when i first tried the exe it gave me "wine mono not installed" (or something to that effect) and early-exited, and i only overcame that after msiexec /iing wine-mono-7.4.0-x86.msi (at which point it started enough to crash for fonts, and I haven't managed to overcome that). there may be problems with my procedure owing to the fact that im (a) stupid and (b) not a prolific wine user, so idk

well. i saw .exe so i tried wine :v

installing all 300M of mono-complete gave me a different error than just -runtime – https://lfs.nabijaczleweli.xyz/0015-cohost-images/2023-01-15-nabijaczleweli_1002162-gave-up-ran-their-e-screenshot.png – naturally, it doesnt say what the supported version is, im not enough of a C# enjoyer to know, and the exception is from a random address inside the program

running it in wine with wine-mono it still explodes on fonts in System.Windows.Forms.[...] in System.Drawing.FontFamily, and idk how id even tell it to just use whatever; under strace i see it opening every single font fc knows about and I have the fonts package so fuck knows which font it wants (well, except that theres a get_GenericSansSerif() in the call stack, but fuck knows what that means)

well, after finding the ENOENTs, i did ln -s /usr/share/wine/fonts /home/nabijaczleweli/.wine/dosdevices/c:/windows/Fonts which made it work(?!). well, it went to https://lfs.nabijaczleweli.xyz/0015-cohost-images/2023-01-15-nabijaczleweli_1002162-gave-up-ran-their-e-screenshot2.png (the last line does actually repeat every 60s, this is the only wine process), and "OleDb is not implemented." probably means that it can't open the accompanying .mdb MS Access database, so ultimately futile.

in reply to @nabijaczleweli's post:

in reply to @nabijaczleweli's post: