Skip to content

Commit

Permalink
Add option to fix manufacturer byte on UID_LEFT_(DE/IN)CREMENT on 7-b…
Browse files Browse the repository at this point in the history
…yte UID
  • Loading branch information
doegox committed Oct 29, 2016
1 parent 0d2f79d commit b95d3f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Firmware/Chameleon-Mini/Button.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ static void ExecuteButtonAction(ButtonActionEnum ButtonAction)

case BUTTON_ACTION_UID_LEFT_INCREMENT:
{
uint8_t offset = 0;
#ifdef SUPPORT_UID7_FIX_MANUFACTURER_BYTE
if (ActiveConfiguration.UidSize == 7) {
offset = 1;
}
#endif
ApplicationGetUid(UidBuffer);
bool Carry = 1;
uint8_t i;

for (i=0; i<ActiveConfiguration.UidSize; i++) {
for (i=offset; i<ActiveConfiguration.UidSize; i++) {
if (Carry) {
if (UidBuffer[i] == 0xFF) {
Carry = 1;
Expand Down Expand Up @@ -91,11 +97,17 @@ static void ExecuteButtonAction(ButtonActionEnum ButtonAction)

case BUTTON_ACTION_UID_LEFT_DECREMENT:
{
uint8_t offset = 0;
#ifdef SUPPORT_UID7_FIX_MANUFACTURER_BYTE
if (ActiveConfiguration.UidSize == 7) {
offset = 1;
}
#endif
ApplicationGetUid(UidBuffer);
bool Carry = 1;
uint8_t i;

for (i=0; i<ActiveConfiguration.UidSize; i++) {
for (i=offset; i<ActiveConfiguration.UidSize; i++) {
if (Carry) {
if (UidBuffer[i] == 0x00) {
Carry = 1;
Expand Down
3 changes: 3 additions & 0 deletions Firmware/Chameleon-Mini/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ SETTINGS += -DCONFIG_ISO14443A_READER_SUPPORT
#Support magic mode on mifare classic configuration
SETTINGS += -DSUPPORT_MF_CLASSIC_MAGIC_MODE

#Don't touch manufacturer byte with BUTTON_ACTION_UID_LEFT_(DE/IN)CREMENT
SETTINGS += -DSUPPORT_UID7_FIX_MANUFACTURER_BYTE

#Support activating firmware upgrade mode through command-line
SETTINGS += -DSUPPORT_FIRMWARE_UPGRADE

Expand Down

0 comments on commit b95d3f2

Please sign in to comment.