Skip to content

Commit

Permalink
Merge pull request #72 from doegox/uid7_fix_manufacturer_byte
Browse files Browse the repository at this point in the history
Add option to fix manufacturer byte on UID_LEFT_(DE/IN)CREMENT on 7-byte UID
  • Loading branch information
geo-rg committed Jan 17, 2017
2 parents 55fdc8d + b95d3f2 commit 64f297c
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
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
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 64f297c

Please sign in to comment.