Skip to content

Commit

Permalink
Debug code: dump all input reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
matlo committed Feb 1, 2020
1 parent 3b910ad commit aa3e8df
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions core/connectors/usb_con.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,19 @@ static void dump(unsigned char * packet, unsigned char length)
}

#define DEBUG_PACKET(TYPE, DATA, LENGTH) \
if(gimx_params.debug.controller) \
{ \
ginfo("%s\n", __func__); \
ginfo("type: 0x%02x\n", TYPE); \
dump(DATA, LENGTH); \
}
do { \
if(gimx_params.debug.usb_con) \
{ \
ginfo("> %s\n", __func__); \
ginfo("type: 0x%02x\n", TYPE); \
dump(DATA, LENGTH); \
} \
} while (0)

static void process_report(int usb_number, struct usb_state * state, unsigned char * buf, unsigned int count) {

DEBUG_PACKET(BYTE_IN_REPORT, buf, count);

int i;
for (i = 0; i < controller[state->type][state->index].endpoints.in.reports.nb; ++i) {
unsigned char report_id = controller[state->type][state->index].endpoints.in.reports.elements[i].report_id;
Expand All @@ -421,8 +425,6 @@ static void process_report(int usb_number, struct usb_state * state, unsigned ch
s_report* current = (s_report*) buf;
s_report* previous = &state->reports[i].report.value;

DEBUG_PACKET(BYTE_IN_REPORT, buf, count)

report2event(state->type, usb_number, (s_report*) current, (s_report*) previous, state->joystick_id);

if (state->type == C_TYPE_DS4 || state->type == C_TYPE_T300RS_PS4 || state->type == C_TYPE_G29_PS4) {
Expand Down

0 comments on commit aa3e8df

Please sign in to comment.