Closed FloRinke closed 3 years ago
By "mixed endian" I mean the following:
Lets use a 4-byte Integer with value 0x11223344
The way modbus-cli currently encodes this into registers is: [0x11,0x22] [0x33,0x44]
The "Mixed Endian" encoding would be [0x33,0x44], [0x11,22], so regular big endian registers, but registers arranged in a little endian way...
I don't really like this, but unfortunately I've got a device which insists on this structure...
Yes please, if you are still interested after all this time, feel free to open a PR to support mixed endianness.
I've just pushed a fix to master, it should work now and you can fork from there.
Hey there! I'm also interested in implementing this feature, and was going to ask, what should the UI look like?
I was wondering if it should be flexible for different ways to mess it up, but considering that we have two different devices from different vendors that have the same kind of mixed endian as what the OP of this ticket described, I guess a single toggle switch -m --mixed-endian
for reading standard big endian registers and re-packing them as little endian could be enough?
I did not pursue this any further, as the problematic device turned out to be unsuitable for my purpose for other reasons. Before this I had it somewhat working, but based on the older, non-modularized code (as the newer one did not run at that time). I can have a look, this should still be laying around somewhere.
@dequis what do you think of a --byte-order=le|be|mixed
argument? We could also accept any order with syntax like --byte-order=2134
(with be
etc. as alias for 1234
)
what do you think of a
--byte-order=le|be|mixed
argument?
Sure!
We could also accept any order with syntax like
--byte-order=2134
(withbe
etc. as alias for1234
)
Thaaat gets a bit more complicated when you want to cover both 32bit and 64bit fields, where you'd have to express (for example) both 3412
and 78563412
True. We don't have any proof of byte orders other than le, be and mixed being used. So I'd say for now let's keep it simple and forget about the 3421
syntax.
Solved by https://github.com/favalex/modbus-cli/pull/13 Thanks @dequis !
Some vendors use a "mixed endian" encoding, where the registers of multi-register data types are swapped. This can not currently be accessed using modbus-cli.
Are you interested in a pull request? (Which commit should I base my work on? Current head seems not to work for me)