-#define INIT1 0 /* sending nulls */
-#define INIT2 1 /* sending inits */
-#define IDLE 2 /* initialized, no transfer in progress */
-#define SENDH 3 /* sending header */
-#define SENDD 4 /* sending data */
-#define SENDC 5 /* sending checksum */
-#define SENDR 6 /* sending read command packet */
-#define SENDW 7 /* sending write command packet */
-#define GETH 8 /* reading header */
-#define GETD 9 /* reading data */
-#define GETC 10 /* reading checksum */
-#define GET 11 /* reading an entire packet */
-#define WAIT 12 /* waiting for continue */
+#define TUS_INIT1 0 /* sending nulls */
+#define TUS_INIT2 1 /* sending inits */
+#define TUS_IDLE 2 /* initialized, no transfer in progress */
+#define TUS_SENDH 3 /* sending header */
+#define TUS_SENDD 4 /* sending data */
+#define TUS_SENDC 5 /* sending checksum */
+#define TUS_SENDR 6 /* sending read command packet */
+#define TUS_SENDW 7 /* sending write command packet */
+#define TUS_GETH 8 /* reading header */
+#define TUS_GETD 9 /* reading data */
+#define TUS_GETC 10 /* reading checksum */
+#define TUS_GET 11 /* reading an entire packet */
+#define TUS_WAIT 12 /* waiting for continue */
+
+#define TUS_NSTATES 13
+char *tustates[TUS_NSTATES] = {
+ "INIT1", "INIT2", "IDLE", "SENDH", "SENDD", "SENDC", "SENDR",
+ "SENDW", "GETH", "GETD", "GETC", "GET", "WAIT"
+};
+#define printstate(state) \
+ if ((state) < TUS_NSTATES) \
+ printf("%s", tustates[(state)]); \
+ else \
+ printf("%d", (state));