Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode file for negative value #60

Open
SyHuangCBN opened this issue Nov 6, 2018 · 5 comments
Open

Encode file for negative value #60

SyHuangCBN opened this issue Nov 6, 2018 · 5 comments

Comments

@SyHuangCBN
Copy link

When I encode txt file (Attached file) including value is negative, the bin file will be changed "2's complement".

docsis -p MTA_bin_integer.txt MTA_bin_integer.bin

The OID type should be integer 32 to avoid transfer value is error.

Could you please provide some advice on how to fix it ?

I used tool to check the value when it had been changed bin file.
bin_file

MTA_bin_integer.txt

@SyHuangCBN SyHuangCBN changed the title Encode bin file for negative value Encode file for negative value Nov 6, 2018
@rlaager
Copy link
Owner

rlaager commented Nov 6, 2018

I don’t really know much about this application. I just took it over to merge some patches.

@SyHuangCBN
Copy link
Author

Did you some advice where I can ask about that ?

Thanks.

@negativeduck
Copy link

So I'm not sure I followed but your other TLV tool did something weird or your mib for the excentis signaling stuff is broken.

Your config file as written encodes and comes out correctly.

after encoding it...
and then just dumping the stuff.
OPT(11) LEN (22) 4820615436141186821133182121156
UNPARSED: :0b:16:30:14:06:0f:2b:06:01:04:01:ba:08:02:01:01:21:01:08:02:01:02:01:9c
which is decimal 156 in 2's puts it at your -100 value which is -10.0 since it's a 10thdb mib.

OPT(11) LEN (23) 4821615436141186821133188122255126	

UNPARSED: :0b:17:30:15:06:0f:2b:06:01:04:01:ba:08:02:01:01:21:01:08:08:01:02:02:ff:7e
gives you 126 2's of -130 or -13.0

OPT(11) LEN (22) 4820615436141186821133189221226	

UNPARSED: :0b:16:30:14:06:0f:2b:06:01:04:01:ba:08:02:01:01:21:01:08:09:02:02:01:e2
226 2's of -30

OPT(11) LEN (22) 4820615436141186821133199166150	

UNPARSED: :0b:16:30:14:06:0f:2b:06:01:04:01:ba:08:02:01:01:21:01:09:09:01:42:01:32
which is your 50 value.

I may very well be miss understanding what your saying is broken. Just trying to help

Did you some advice where I can ask about that ?

Thanks.

@SyHuangCBN
Copy link
Author

negativeduck, Thanks for your help.

I just want to know how to change "Type" from "integer" to "integer32" for Docsis tool.

Due to I saw the value if it's negative, after encode, it will be "2's complement".

Now, I make another encode and decode to do that.

@negativeduck
Copy link

So that's the thing... your encoding an SnmpObject a numerical value which integer and integer32 are the same thing in that context. That's where there is no Integer32 distinction.

But with ToneDbLevel your valid values are -250 .. -30
if you are trying to make it store the value as a 32 bit number IE 4294967196
Then if you list it as -100 and guage32 or something but he encode will likely yell at you. And I would say there is a strong chance the emta would barf on it.

What value are expecting to see in your other TLV reader when you view it? since you are trying to store a negative value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants