Part 6 of the fifth-protocol series. By the evening one FK terminal was read every minute. The office had a second one coming. Code written against one terminal has that terminal's settings baked into it in places nobody wrote down, so the next step was an audit with one question: what does the connector assume because this terminal happened to be that way?
Each finding below was fixed with one test, and each test was checked by taking the fix out and watching it fail.
1. The device number was always 1
Every request carries the terminal's device number, and the reader had it as a constant: 1, the factory value and this terminal's. A second terminal set to device 2, which is what an office does when it has two, would never answer.
The device number now comes from the platform with the rest of the terminal's settings, and is 1 when not set. HR sets it in the same side pane as the address and port. The test runs two terminals on one PC, the second on device 2; without the fix it reads nothing from the second.
2. The refusal blamed a password
The error said: the terminal refused; if a communication password is set, set it to 0. That was the right guess when nothing else was known. It was wrong all day, because this terminal had no password: it had answered the hello, which a passworded terminal refuses.
Once the hello has succeeded on a connection, a refusal now names the step: the punch count, the punches, or a name. That is what someone at the terminal can act on, and what support needs to read in the PC's report.
3. A fixed terminal waited five minutes
- ✕+0m
- ·fix
- ·+2m
- ·+3m
- ·+4m
- read+5m
- read+6m
- read+7m
Before: the fix goes in at minute 1 and nothing happens until minute 5. On site, that read as the fix not working.
The slow-retry rule is right: a terminal that has failed for half an hour is probably off, and trying it every minute holds the PC up for a read that times out. But the same rule meant a terminal someone had just fixed stayed silent for up to five minutes, and on site that looked exactly like the fix not working.
The run of failures is now forgotten when the connector is updated, and when the terminal's address, port, device number or key changes. Those are the moments a person has just done something and is waiting to see if it worked.
4. "Look for it" could not find a terminal without a serial
When a terminal stops answering, the PC can look for it: at an address someone typed, or across the network. The search matched what it found by serial. The FK terminal never sends one, so the search could find it and not know it had.
Now, at an address someone typed, the terminal answering in its protocol is enough: a person read that address off the terminal's own screen. Across the network it needs more, because another terminal of the same family could be next door: a match on the network ID, or a newest punch that matches the last one read. Anything else is listed as a candidate for a person to confirm.
5. More than 65,535 records
The record count comes back in 32 bits, but the download request has 16 bits to send it in. A terminal with more records than that would be read short. The reader now sends what fits and keeps reading blocks until it has the count it was told, so the newest records are never the ones left out. The test fills a 20-byte terminal past that size and checks the last record.
6. Two terminals on one PC
The ingredients above meet in one case: two FK terminals read by the same PC. Run end to end against two pretend terminals as separate programs, on different ports and device numbers, the second with its port first set wrong and then fixed:
| Terminal 1 | Terminal 2 | |
|---|---|---|
| First read | starts from now | starts from now |
| Live punches uploaded | 18 | 21 |
| Read after its port was fixed | n/a | next minute |
| Older punches on request | yes | yes |
| People list | yes | yes |
| Uploaded twice after a restart | 0 | 0 |
| Punches that went to the other terminal | 0 | 0 |
A terminal with no serial also needs a stable identity on the platform, or two of them would share every note the connector keeps per terminal. The platform gives each one a stand-in made from its network ID when it is added, so the PC never sees a blank.
What it could not settle
Three things need a real terminal, and were left as open questions rather than guesses:
- The two checksum bytes after each block. One sample fits a simple sum of the data. One sample is not enough to reject a read over it.
- The clock. Reading or setting it needs a request that is not public. Setting it writes to the terminal, so it waits for the vendor's command or a capture of the vendor's software. Reading a clock you cannot touch is what happens instead.
- The wrong device number. The pretend terminal stays silent when asked with a number that is not its own. A real one might answer with "no". The reader treats both as "not this terminal".
The pattern
Every one of these was invisible with one terminal, because one terminal could not be anything other than itself: device 1, no password, no history of failures, its own address. The audit's question works anywhere: list what the code got from the one example it was tested against, and make each of those an input.