Skip to content

Commit

Permalink
Updated universal/picow/base for card + PIN (cf. #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
twystd committed Oct 19, 2023
1 parent 7402bbd commit c5d131a
Show file tree
Hide file tree
Showing 22 changed files with 224 additions and 201 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

### Added
1. Keypad emulation
2. _clear-acl_ command
2. Passcode access override
3. Card + optional PIN access
4. _clear-acl_ command

### Updated
1. Fixed bug in SD card _store-acl_ logic.
Expand Down
78 changes: 47 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,37 +83,53 @@ single letter mnemonics and need to be terminated by a carriage return and/or li

The supported command set comprises:

| *Command* | *Description* |
| --------------------- | --------------------------------------- |
| T yyyy-mm-dd HH:mm:ss | Set date/time |
| CARD nnnnnnnn | Emulates card swipe |
| CODE ddddddd | Emulates keypad |
| | |
| LIST ACL | List cards in ACL |
| CLEAR ACL | Deletes all cards in ACL |
| GRANT nnnnnn | Grant card access rights |
| REVOKE nnnnnn | Revoke card access rights |
| QUERY | Display last card read/write |
| | |
| MOUNT | Mount SD card |
| UNMOUNT | Unmount SD card |
| FORMAT | Format SD card |
| | |
| UNLOCK | Unlocks door for 5 seconds |
| OPEN | Emulates door open contact |
| CLOSE | Emulates door close contact |
| PRESS | Emulates pushbutton press |
| RELEASE | Emulates pushbutton release |
| | |
| BLINK | Blinks reader LED 5 times |
| CLS | Reinitialises terminal |
| REBOOT | Reboot |
| ? | Display list of commands |


Notes:
1. The default facility code for _emulator_ mode is a build time constant (`FACILITY_CODE` in the _Makefile_) and will
be used if the _W_ command card number is 5 digits or less.
| *Command* | *Mode* | *Description* |
| -------------------------|--------------|-------------------------------------------|
| TIME yyyy-mm-dd HH:mm:ss | _ALL_ | Set date/time |
| CARD nnnnnnnn | _emulator_ | Emulates card swipe |
| CODE dddddd | _emulator_ | Emulates keypad |
| | | |
| LIST ACL | _controller_ | List cards in ACL |
| CLEAR ACL | _controller_ | Deletes all cards in ACL |
| GRANT nnnnnn dddddd | _controller_ | Grant card (+ optional PIN) access rights |
| REVOKE nnnnnn | _controller_ | Revoke card access rights |
| QUERY | _controller_ | Display last card read/write |
| | | |
| MOUNT | _ALL_ | Mount SD card |
| UNMOUNT | _ALL_ | Unmount SD card |
| FORMAT | _ALL_ | Format SD card |
| | | |
| UNLOCK | _controller_ | Unlocks door for 5 seconds |
| | | |
| OPEN | _emulator_ | Emulates door open contact |
| CLOSE | _emulator_ | Emulates door close contact |
| PRESS | _emulator_ | Emulates pushbutton press |
| RELEASE | _emulator_ | Emulates pushbutton release |
| | | |
| BLINK | _ALL_ | Blinks reader LED 5 times |
| CLS | _ALL_ | Reinitialises terminal |
| REBOOT | _ALL_ | Reboot |
| ? | _ALL_ | Display list of commands |


## Build constants

The _build constants_ in the _Makefiles_ define the initial operational settings:

| *Constant* | *Description* |
|----------------------|-----------------------------------------------------------------------------------------------------------|
| `FACILITY_CODE` | The default facility code for _emulator_ mode, used if the _CARD_ command card number is 5 digits or less |
| `SYSDATE` | Initial system date |
| `SYSTIME` | Initial system time |
| `MASTER_PASSCODE` | Default master access override code |
| `KEYPAD` | Keypad mode ('4-bit' or '8-bit') |
| `SSID` | WiFi SSID |
| `PASSWORD` | WiFi password |
| `TCPD_CLI_PORT` | TCP port for the Telnet CLI |
| `TCPD_LOG_PORT` | TCP port for the network logger |
| `TCPD_SERVER_IDLE` | Idle time (seconds) after which the TCP server closes all connections and restarts |
| `TCPD_CLIENT_IDLE` | Idle time (seconds) after which a Telnet CLI client connection is closed |
| `TCPD_POLL_INTERVAL` | Internal TCP handler poll interval (ms) |


## References and Related Projects
Expand Down
26 changes: 21 additions & 5 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,31 @@
- [x] 8-bit burst mode write
- [x] 8-bit burst mode read
- [x] card + PIN writer
- [x] FIXME in acl.c
- [ ] card + PIN read
- [x] timeout on keycode
- [x] rework ACL as struct (with cards, timer, etc)
- [ ] _reference_ implementation
- [x] FIXME in acl.c
- [ ] Check mode == CONTROLLER in unlock, etc
- [ ] Update other variants
- [ ] controller
- [ ] picow/wifi
- [ ] picow/wifi+usb
- [ ] pico/base
- [ ] pico/usb
- [ ] universal
- [x] picow/base
- [ ] picow/wifi
- [ ] picow/wifi+usb
- [ ] pico/base
- [ ] pico/usb
- [ ] Remove debug stuff
- [ ] Check mode == CONTROLLER/READER in unlock, etc
- [ ] README
- [ ] CHANGELOG
- [ ] Remove debug stuff
- [x] build constants
- [ ] _modes_
- [ ] keypad modes
- [ ] passcodes
- [ ] master passcode
- [x] CHANGELOG

- [ ] PicoW+TCP/IP
- [ ] Figure out SD card detect interrupt conflict
Expand Down
10 changes: 5 additions & 5 deletions pico/controller/common/src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ void execw(char *cmd, txrx f, void *context) {
cli_set_time(&cmd[5], f, context);
} else if (strncasecmp(cmd, "blink", 5) == 0) {
cli_blink(f, context);
} else if (strncasecmp(cmd, "query", 5) == 0) {
query(f, context);
} else if (strncasecmp(cmd, "unlock", 6) == 0) {
cli_unlock_door(f, context);
} else if (strncasecmp(cmd, "mount", 5) == 0) {
Expand All @@ -84,6 +82,8 @@ void execw(char *cmd, txrx f, void *context) {
cli_acl_revoke(&cmd[7], f, context);
} else if (strncasecmp(cmd, "passcodes", 9) == 0) {
cli_set_passcodes(&cmd[9], f, context);
} else if (strncasecmp(cmd, "query", 5) == 0) {
query(f, context);
} else if (strncasecmp(cmd, "debugx", 7) == 0) {
debug(f, context, 1);
} else if (strncasecmp(cmd, "debugy", 7) == 0) {
Expand Down Expand Up @@ -146,17 +146,17 @@ void help(txrx f, void *context) {
f(context, "");
f(context, "LIST ACL List cards in ACL");
f(context, "CLEAR ACL Revoke all cards in ACL");
f(context, "GRANT nnnnnn Grant card access rights");
f(context, "GRANT nnnnnn dddddd Grant card (+ optional PIN) access rights");
f(context, "REVOKE nnnnnn Revoke card access rights");
f(context, "PASSCODES Sets the override passcodes");
f(context, "QUERY Display last card read/write");
f(context, "");
f(context, "UNLOCK Unlocks door");
f(context, "");
f(context, "MOUNT Mount SD card");
f(context, "UNMOUNT Unmount SD card");
f(context, "FORMAT Format SD card");
f(context, "");
f(context, "UNLOCK Unlocks door");
f(context, "LOCK Locks door");
f(context, "BLINK Blinks reader LED 5 times");
f(context, "CLS Resets the terminal");
f(context, "REBOOT Reboot");
Expand Down
Loading

0 comments on commit c5d131a

Please sign in to comment.