use default case instead of handling other packet statuses explicitely

Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
This commit is contained in:
Amir Hammad 2016-09-11 12:03:20 +02:00
parent bacf8ecdbb
commit 4415d960c3
5 changed files with 20 additions and 47 deletions

View file

@ -408,9 +408,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_
CONTINUE_WITH(USBH_ENUM_STATE_DEVICE_DT_READ_SETUP);
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
device_enumeration_terminate(dev);
ERROR(cb_data.status);
break;
@ -458,8 +456,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
default:
device_enumeration_terminate(dev);
ERROR(cb_data.status);
break;
@ -492,9 +489,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_
dev->packet_size_max0, device_enumerate, dev);
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
device_enumeration_terminate(dev);
ERROR(cb_data.status);
break;
@ -520,8 +515,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_
}
break;
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
default:
device_enumeration_terminate(dev);
ERROR(cb_data.status);
break;
@ -560,9 +554,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
device_enumeration_terminate(dev);
ERROR(cb_data.status);
break;
@ -583,9 +575,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
device_enumeration_terminate(dev);
ERROR(cb_data.status);
break;
@ -619,9 +609,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_
CONTINUE_WITH(USBH_ENUM_STATE_FIND_DRIVER);
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
device_enumeration_terminate(dev);
ERROR(cb_data.status);
break;

View file

@ -163,12 +163,13 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t status)
midi_in_message(midi, midi->endpoint_in_maxpacketsize);
midi->state = 25;
break;
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
midi_in_message(midi, status.transferred_length);
midi->state = 25;
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
default:
LOG_PRINTF("FATAL ERROR, MIDI DRIVER DEAD \n");
//~ dev->drv->remove();
midi->state = 0;

View file

@ -257,8 +257,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
gp_xbox->state_next = STATE_READING_REQUEST;
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
default:
ERROR(cb_data.status);
gp_xbox->state_next = STATE_INACTIVE;
break;

View file

@ -231,8 +231,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
hid->state_next = STATE_READING_REQUEST;
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
default:
ERROR(cb_data.status);
hid->state_next = STATE_INACTIVE;
break;
@ -251,9 +250,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
parse_report_descriptor(hid, hid->buffer, cb_data.transferred_length);
break;
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
default:
ERROR(cb_data.status);
hid->state_next = STATE_INACTIVE;
break;

View file

@ -187,8 +187,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
ERROR(cb_data.status);
hub->state = EVENT_STATE_NONE;
break;
@ -262,8 +261,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
default:
ERROR(cb_data.status);
break;
}
@ -308,9 +306,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
ERROR(cb_data.status);
break;
}
@ -343,9 +339,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
ERROR(cb_data.status);
break;
}
@ -414,9 +408,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
ERROR(cb_data.status);
// continue
hub->state = EVENT_STATE_POLL_REQ;
@ -460,9 +452,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
ERROR(cb_data.status);
// continue
hub->state = EVENT_STATE_POLL_REQ;
@ -531,9 +521,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
}
break;
case USBH_PACKET_CALLBACK_STATUS_EFATAL:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
default:
ERROR(cb_data.status);
// continue
hub->state = EVENT_STATE_POLL_REQ;