summaryrefslogtreecommitdiff
path: root/easytool
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-08-15 11:24:26 +0800
committerHarald Welte <laforge@gnumonks.org>2010-08-15 11:24:26 +0800
commitc9601a9576d7a98bbe7322e201fa5e7aec2c03fa (patch)
treed206e8cffe20c61c8566b7e7cafcaf3e2086c260 /easytool
parenta2dbdd6fd606f47838321a3ce9968fc2361ee7f9 (diff)
easytool: Decode the last MRT station entered/left fields
Diffstat (limited to 'easytool')
-rw-r--r--easytool/easycard.h9
-rw-r--r--easytool/easytool.c13
2 files changed, 21 insertions, 1 deletions
diff --git a/easytool/easycard.h b/easytool/easycard.h
index fb4d93d..37caf1f 100644
--- a/easytool/easycard.h
+++ b/easytool/easycard.h
@@ -28,6 +28,15 @@ struct easy_sect15blk2 {
uint8_t unknown3;
} __attribute__ ((packed));
+/* Sector 7 */
+struct easy_sect7blk {
+ uint8_t unknown[3];
+ uint8_t value1;
+ uint8_t station_code;
+ uint8_t unknown2[5];
+ uint8_t timestamp[3];
+ uint8_t unknown3[3];
+} __attribute__ ((packed));
/* storage of a transaction log record on the transponder itself */
struct easy_log_rec {
diff --git a/easytool/easytool.c b/easytool/easytool.c
index cb9fe30..1a9eef9 100644
--- a/easytool/easytool.c
+++ b/easytool/easytool.c
@@ -96,6 +96,10 @@ static void dump_easycard(mifare_tag *mft)
(struct easy_sect2blk0 *) mft->amb[1*4+0].mbd.abtData;
struct easy_sect15blk2 *b15s2 =
(struct easy_sect15blk2 *) mft->amb[15*4+2].mbd.abtData;
+ struct easy_sect7blk *mrt_enter =
+ (struct easy_sect7blk *) mft->amb[7*4+2].mbd.abtData;
+ struct easy_sect7blk *mrt_leave =
+ (struct easy_sect7blk *) mft->amb[7*4+1].mbd.abtData;
uint32_t uid = *((uint32_t *) manuf->abtUID);
/* dump the header */
@@ -105,9 +109,16 @@ static void dump_easycard(mifare_tag *mft)
printf("Current Balance: %5u NTD\n", val->value);
printf("Sum of all purchases on day %u (of month): %u NTD\n",
b15s2->day_of_month, b15s2->sum_of_day);
- printf("\nTransaction Log:\n");
+
+ printf("Last MRT station entered: %s (%s)\n",
+ get_value_string(taipei_mrt_stn_id, mrt_enter->station_code),
+ easy_asc_timestamp(mrt_enter->timestamp));
+ printf("Last MRT station left: %s (%s)\n",
+ get_value_string(taipei_mrt_stn_id, mrt_leave->station_code),
+ easy_asc_timestamp(mrt_leave->timestamp));
/* dump the transaction log */
+ printf("\nTransaction Log:\n");
easy_dump_log(mft);
}
personal git repositories of Harald Welte. Your mileage may vary