Skip to content

Commit d3cc69c

Browse files
fhirschmannclaude
andcommitted
feat: add SLIX2 password support
Implement ICODE-SLIX2 password authentication in the PN5180 reader (disable privacy mode) with a configurable 8-digit hex password, stored in NVS and editable from the RFID settings in the web interface. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent b116151 commit d3cc69c

6 files changed

Lines changed: 60 additions & 11 deletions

File tree

‎html/locales/de.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@
396396
"description": "Wähle den Typ des RFID readers. Auto-detect wird versuchen den Reader automatisch zu erkennen.",
397397
"pn5180Lpcd": "PN5180 LPCD aktivieren",
398398
"pn5180LpcdExp": "Aktiviert Low Power Card Detection für PN5180 RFID Reader. Nur möglich, wenn Lötbrücken richtig gesetzt sind.",
399+
"slix2Password": {
400+
"title": "SLIX2 Passwort",
401+
"description": "8-stelliges Passwort in Hexadezimal-Format (z.B. 01020304) zum Auslesen von SLIX2-Tags."
402+
},
399403
"mfrc522Gain": "MFRC522 Gain",
400404
"mfrc522GainExp": "Stellt die Empfindlichkeit des MFRC522 RFID Readers ein. Mögliche Werte sind 0 (niedrigste Empfindlichkeit) bis 7 (höchste Empfindlichkeit). Standard ist 7."
401405
},

‎html/locales/en.json‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,13 @@
396396
},
397397
"description": "Select the type of RFID reader connected to your ESPuino. Auto-detect will try to determine the connected reader type automatically.",
398398
"pn5180Lpcd": "Enable PN5180 LPCD",
399-
"pn5180LpcdExp": "Enable Low Power Card Detection for PN5180 RFID reader. Only possible if solder-pins are set correctly.",
399+
"pn5180LpcdExp": "Enables Low Power Card Detection for PN5180 RFID reader. Only possible if solder jumpers are set correctly.",
400+
"slix2Password": {
401+
"title": "SLIX2 Password",
402+
"description": "8-digit password in hexadecimal format (e.g. 01020304) for reading SLIX2 tags."
403+
},
400404
"mfrc522Gain": "MFRC522 Gain",
405+
401406
"mfrc522GainExp": "Sets the sensitivity of the MFRC522 RFID reader. Possible values are 0 (lowest sensitivity) to 7 (highest sensitivity). Default is 7."
402407
},
403408
"options": {

‎html/management.html‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,18 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
974974
<a href="#" class="link-secondary" data-bs-toggle="popover"
975975
data-i18n="[data-bs-content]general.rfid.pn5180LpcdExp" tabindex="0"><i
976976
class="fas fa-circle-question"></i></a>
977+
</div><br>
978+
<div class="mb-3">
979+
<label for="slix2Password" data-i18n="general.rfid.slix2Password.title"></label>
980+
<div class="input-group">
981+
<input type="text" class="form-control" id="slix2Password" name="slix2Password"
982+
maxlength="8" placeholder="e.g. 01020304">
983+
<span class="input-group-text bg-transparent border-0">
984+
<a href="#" class="link-secondary" data-bs-toggle="popover"
985+
data-i18n="[data-bs-content]general.rfid.slix2Password.description" tabindex="0">
986+
<i class="fas fa-circle-question"></i></a>
987+
</span>
988+
</div>
977989
</div>
978990
</fieldset>
979991
</div>
@@ -2537,9 +2549,18 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
25372549
$('#pauseOnMinVolume').prop('checked', genSettings.pauseOnMinVol);
25382550
$('#recoverVolBoot').prop('checked', genSettings.recoverVolBoot);
25392551
$('#volumeCurve').prop('checked', genSettings.volumeCurve > 0);
2540-
$('#rfidReaderType').val(genSettings.rfidReaderType);
2541-
$('#pn5180Lpcd').prop('checked', genSettings.pn5180Lpcd);
2542-
$('#mfrc522Gain').val(genSettings.mfrc522Gain);
2552+
if (genSettings.rfidReaderType !== undefined) {
2553+
$('#rfidReaderType').val(genSettings.rfidReaderType);
2554+
}
2555+
if (genSettings.pn5180Lpcd !== undefined) {
2556+
$('#pn5180Lpcd').prop('checked', genSettings.pn5180Lpcd);
2557+
}
2558+
if (genSettings.slix2Password !== undefined) {
2559+
$('#slix2Password').val(genSettings.slix2Password);
2560+
}
2561+
if (genSettings.mfrc522Gain !== undefined) {
2562+
document.getElementById('mfrc522Gain').value = genSettings.mfrc522Gain;
2563+
}
25432564
}
25442565
// current values
25452566
let currSettings = settings.current;
@@ -2954,6 +2975,7 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
29542975
volumeCurve: $("#volumeCurve").prop('checked') ? 1 : 0,
29552976
rfidReaderType: Number($('#rfidReaderType').val()),
29562977
pn5180Lpcd: $('#pn5180Lpcd').prop('checked'),
2978+
slix2Password: $('#slix2Password').val(),
29572979
mfrc522Gain: Number($('#mfrc522Gain').val())
29582980
},
29592981
"led": {

‎src/RfidPn5180.cpp‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void RfidPn5180_Init(void) {
100100
xTaskCreatePinnedToCore(
101101
RfidPn5180_Task, /* Function to implement the task */
102102
"rfid", /* Name of the task */
103-
3072, /* Stack size in words */
103+
4096, /* Stack size in words */
104104
NULL, /* Task input parameter */
105105
2 | portPRIVILEGE_BIT, /* Priority of the task */
106106
&rfidTaskHandle, /* Task handle. */
@@ -129,6 +129,19 @@ void RfidPn5180_Task(void *parameter) {
129129
uint8_t uid[10];
130130
bool showDisablePrivacyNotification = true;
131131

132+
// SLIX2 Password caching
133+
uint8_t password[8] = {0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00};
134+
uint8_t passwordLength = 4;
135+
136+
String savedPwd = gPrefsRfid.getString("slix2Pwd", "");
137+
if (savedPwd.length() >= 8) {
138+
passwordLength = (savedPwd.length() >= 16) ? 8 : 4;
139+
for (uint8_t i = 0; i < passwordLength; i++) {
140+
char hex[3] = {savedPwd[i * 2], savedPwd[i * 2 + 1], '\0'};
141+
password[i] = (uint8_t) strtol(hex, NULL, 16);
142+
}
143+
}
144+
132145
// wait until queues are created
133146
while (gRfidCardQueue == NULL) {
134147
Log_Println(waitingForTaskQueues, LOGLEVEL_DEBUG);
@@ -193,12 +206,6 @@ void RfidPn5180_Task(void *parameter) {
193206
nfc15693.setupRF();
194207
} else if (RFID_PN5180_NFC15693_STATE_DISABLEPRIVACYMODE == stateMachine) {
195208
// check for ICODE-SLIX2 password protected tag
196-
// put your privacy password here, e.g.:
197-
// https://de.ifixit.com/Antworten/Ansehen/513422/nfc+Chips+f%C3%BCr+tonies+kaufen
198-
//
199-
// default factory password for ICODE-SLIX2 is {0x0F, 0x0F, 0x0F, 0x0F}
200-
//
201-
const uint8_t password[] = {0x0F, 0x0F, 0x0F, 0x0F};
202209
ISO15693ErrorCode myrc = nfc15693.disablePrivacyMode(password);
203210
if (ISO15693_EC_OK == myrc) {
204211
if (showDisablePrivacyNotification) {

‎src/Web.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,13 @@ WebsocketCodeType JSONToSettings(JsonObject doc) {
690690
success = success && (gPrefsSettings.putUChar("volumeCurve", generalObj["volumeCurve"].as<uint8_t>()) != 0);
691691
success = success && (gPrefsRfid.putUChar("rfidReaderType", generalObj["rfidReaderType"].as<uint8_t>()) != 0);
692692
success = success && (gPrefsRfid.putBool("pn5180Lpcd", generalObj["pn5180Lpcd"].as<bool>()) != 0);
693+
if (generalObj["slix2Password"].is<const char *>()) {
694+
const char *pwd = generalObj["slix2Password"].as<const char *>();
695+
size_t written = gPrefsRfid.putString("slix2Pwd", pwd);
696+
if (strlen(pwd) > 0 && written == 0) {
697+
success = false;
698+
}
699+
}
693700
success = success && (gPrefsRfid.putUChar("mfrc522Gain", generalObj["mfrc522Gain"].as<uint8_t>()) != 0);
694701
if (!success) {
695702
Log_Printf(LOGLEVEL_ERROR, webSaveSettingsError, "general");
@@ -1038,6 +1045,7 @@ static void settingsToJSON(JsonObject obj, const String section) {
10381045
generalObj["dontAcceptRfidTwice"].set(gPrefsSettings.getBool("dAccRfidTwice", false)); // DONT_ACCEPT_SAME_RFID_TWICE
10391046
generalObj["rfidReaderType"].set(gPrefsRfid.getUChar("rfidReaderType", 0)); // RFID_READER_TYPE_RUNTIME
10401047
generalObj["pn5180Lpcd"].set(gPrefsRfid.getBool("pn5180Lpcd", false)); // PN5180 LPCD
1048+
generalObj["slix2Password"].set(gPrefsRfid.getString("slix2Pwd", "")); // SLIX2 Password
10411049
generalObj["mfrc522Gain"].set(gPrefsRfid.getUChar("mfrc522Gain", 7)); // MFRC522_GAIN
10421050
generalObj["pauseOnMinVol"].set(gPrefsSettings.getBool("pauseOnMinVol", false)); // PAUSE_ON_MIN_VOLUME
10431051
generalObj["recoverVolBoot"].set(gPrefsSettings.getBool("recoverVolBoot", false)); // USE_LAST_VOLUME_AFTER_REBOOT

‎src/settings-override.h.sample‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@
210210
#define CHIPSET WS2812B // type of Neopixel
211211
#define COLOR_ORDER GRB
212212
#define NUM_LEDS_IDLE_DOTS 4 // count of LEDs, which are shown when Idle
213+
#define IDLE_COLOR CRGB::White // color of the idle dots
213214
#define OFFSET_PAUSE_LEDS false // if true the pause-leds are centered in the mid of the LED-Strip
215+
#define PROGRESS_COLOR_START 0x00FF00 // start color of the progress bar
216+
#define PROGRESS_COLOR_END 0xFF0000 // end color of the progress bar
214217
#define PROGRESS_HUE_START 85 // Start and end hue of mulitple-LED progress indicator. Hue ranges from basically 0 - 255, but you can also set numbers outside this range to get the desired effect (e.g. 85-215 will go from green to purple via blue, 341-215 start and end at exactly the same color but go from green to purple via yellow and red)
215218
#define PROGRESS_HUE_END -1
216219
#define DIMMABLE_STATES 50 // Number of dimmed values between two full LEDs (https://forum.espuino.de/t/led-verbesserungen-rework/1739)

0 commit comments

Comments
 (0)