uhppoted / uhppote-core

Go device level API for the UHPPOTE UT0311 TCP/IP access controller boards
MIT License
7 stars 2 forks source link

Invalid facility code Error msg #15

Closed tabacha closed 1 year ago

tabacha commented 1 year ago

Hi, when we try to add a new card with the id: 38857wxyz

/bin/uhppote-cli put-card 223190abc 38857wxyz 2023-01-01 2060-01-01 1,2,3,4:2 1234

We got an error msg: ERROR: 388575490: invalid facility code 388

So we commented out the code: image and afterwards we can put the card to the controller.

abc and wxyz are digits, replaced by us.

uhppoted commented 1 year ago

Hi,

That check was added in the last release as a basic validity check to ensure that card numbers conform to the Wiegand-26 format - although the controllers themselves don't actually care.

Question: what model controller and what format Wiegand card are you using?

I'm curious because e.g. 388575490 is not a valid Wiegand-26 card number - it has a facility code of 388 and a card number 575490 whereas the largest facility code for a Wiegand-26 card is 255 (1 byte) and the largest card number is 65535 (2 bytes) and to the best of my knowledge the UHPPOTE controllers don't support Wiegand-34.

tabacha commented 1 year ago

Hi,

the model of the cards and the controller I will send you later, after i have this information. When I convert 388575490 to binary I will get:

10111001010010011000100000010 this are 28 bits not 26 bits.

We just thinking about moving from our Windows software to uhppoted. We have 300-500 cards in the Windows database, the number of the card looks here the same as in uhppoted. Also in Event Messages the card looks like this. Perhabs you implement a software switch if a user wants an validation or not?

uhppoted commented 1 year ago

Hi,

Your cards are quite possibly Wiegand-34 (32 bits + 2 parity bits) - it's the other common standard. I just wasn't aware that the UHPPOTE controllers supported Wiegand-34 readers because so far all the systems I've run into have been Wiegand-26 (24 bits + 2 parity bits). Interesting! I'm going to have add support for Wiegand-34 where necessary...

re. software switch. Agreed, I think that's probably the best way forward because I'd prefer to keep the card validation where possible (it saves a lot of finger trouble). I need to think about it a bit more but it will probably comprise:

Umm, I need to wrap up the changes I'm currently busy with so will probably only get to it next week sometime if that's ok?

uhppoted commented 1 year ago

Hi,

After a fair bit of thought (and much reading - it turns out Wiegand-34 is the HID term for a plethora of custom formats) the CLI card validation has been reworked to work as follows:

I still need to test this a bit more and the next release is 6-8 weeks away but the version in the master branch should (hopefully) work sufficiently well for your purposes.

Any feedback would be much appreciated!

tabacha commented 1 year ago

Hi,

realy good solution. Thank you for your support.

Best Regards Sven

uhppoted commented 1 year ago

Great! Thank you :-) ... I'll leave this open for a bit in case something turns up over the next week or so.

uhppoted commented 1 year ago

Going to close this - seems to be ok, but feel free to reopen if anything turns up :-) (the fix will be included in the next release which is some weeks away)