+ } else if (ch < 0x20 || ch > 0x7e) {
+ dbg(DMSG, "Illegal character (0x%02X) received", *p);
+ mp->inp = mp->data;
+ } else {
+ *mp->inp++ = ch;
+ }
+ break;
+
+ case 1:
+ mp->state = 2;
+ if (ch >= '0' && ch <= '9')
+ c = (ch - '0') << 4;
+ else if (ch >= 'A' && ch <= 'F')
+ c = (ch - 'A' + 10) << 4;
+ else if (ch >= 'a' && ch <= 'a')
+ c = (ch - 'a' + 10) << 4;
+ else {
+ dbg(DMSG, "Illegal hex char (%c) received in state %d", ch, mp->state);
+ mp->inp = mp->data;
+ mp->state = 0;
+ }
+ break;
+
+ case 2:
+ if (ch >= '0' && ch <= '9')
+ *mp->inp++ = c | (ch - '0');
+ else if (ch >= 'A' && ch <= 'F')
+ *mp->inp++ = c | (ch - 'A' + 10);
+ else if (ch >= 'a' && ch <= 'a')
+ *mp->inp++ = c | (ch - 'a' + 10);
+ else {
+ dbg(DMSG, "Illegal hex char (%c) received in state %d", ch, mp->state);
+ mp->inp = mp->data;