summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2016-09-11 12:03:20 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2016-09-11 13:31:48 +0200
commit4415d960c3d1e52573db02be4aee6e22d22809cf (patch)
tree5fb726233f1067a6c4866f00a651405921ee029f /src
parentbacf8ecdbb65774f04fce6ec6cd373a2651ddd67 (diff)
downloadsecure-hid-4415d960c3d1e52573db02be4aee6e22d22809cf.tar.gz
secure-hid-4415d960c3d1e52573db02be4aee6e22d22809cf.tar.bz2
secure-hid-4415d960c3d1e52573db02be4aee6e22d22809cf.zip
use default case instead of handling other packet statuses explicitely
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/usbh_core.c26
-rw-r--r--src/usbh_driver_ac_midi.c5
-rw-r--r--src/usbh_driver_gp_xbox.c3
-rw-r--r--src/usbh_driver_hid.c7
-rw-r--r--src/usbh_driver_hub.c26
5 files changed, 20 insertions, 47 deletions
diff --git a/src/usbh_core.c b/src/usbh_core.c
index 88fd665..1a60285 100644
--- a/src/usbh_core.c
+++ b/src/usbh_core.c
@@ -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;
diff --git a/src/usbh_driver_ac_midi.c b/src/usbh_driver_ac_midi.c
index 50ef963..96cf383 100644
--- a/src/usbh_driver_ac_midi.c
+++ b/src/usbh_driver_ac_midi.c
@@ -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;
diff --git a/src/usbh_driver_gp_xbox.c b/src/usbh_driver_gp_xbox.c
index d9e6d79..957cb3e 100644
--- a/src/usbh_driver_gp_xbox.c
+++ b/src/usbh_driver_gp_xbox.c
@@ -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;
diff --git a/src/usbh_driver_hid.c b/src/usbh_driver_hid.c
index 15af80b..bb842db 100644
--- a/src/usbh_driver_hid.c
+++ b/src/usbh_driver_hid.c
@@ -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;
diff --git a/src/usbh_driver_hub.c b/src/usbh_driver_hub.c
index 959a6c2..3f51c68 100644
--- a/src/usbh_driver_hub.c
+++ b/src/usbh_driver_hub.c
@@ -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;