tjko / nxgipd

nxgipd - a monitoring daemon for UTC Interlogix / GE Security / Caddx NetworX series alarm systems
GNU General Public License v2.0
39 stars 19 forks source link

PIN parsing in nxcmd has flipped nibbles #2

Closed Dogora closed 9 years ago

Dogora commented 9 years ago

Line 372 in nxcmd.c is this: ipcmsg.data[offset++] = ( ((pin[i] - '0') << 4) | (pin[i+1] - '0') );

It needs to be this: ipcmsg.data[offset++] = ( ((pin[i+1] - '0') << 4) | (pin[i] - '0') );

A four-digit PIN, entered as '1234' needs to be parsed into: data[3] = 0x21; data[4] = 0x43; data[5] = 0x00;

Or, a six-digit PIN, '123456' needs to be parsed to: data[3] = 0x21; data[4] = 0x43; data[5] = 0x65;

The NX-584 Comms Protocol document talks about which digit goes in which nibble. I have tried this fix and it works.

tjko commented 9 years ago

Good catch! Thanks for the fix, its now checked in: 6c173345e314f2e6e814c42ae508055499a34ca1