File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1307,7 +1307,7 @@ int usb_dusb_device(usb_event_t *event) {
13071307 }
13081308 break ;
13091309 case DUSB_OS_PING_WAIT_STATE :
1310- case DUSB_VAR_PING_WAIT_STATE :
1310+ case DUSB_VAR_PING_WAIT_STATE : {
13111311 * buffer ++ = (transfer_length - DUSB_RPKT_HEADER_SIZE ) >> 24 & 0xFF ;
13121312 * buffer ++ = (transfer_length - DUSB_RPKT_HEADER_SIZE ) >> 16 & 0xFF ;
13131313 * buffer ++ = (transfer_length - DUSB_RPKT_HEADER_SIZE ) >> 8 & 0xFF ;
@@ -1321,17 +1321,19 @@ int usb_dusb_device(usb_event_t *event) {
13211321 * buffer ++ = DUSB_VPKT_PING >> 8 & 0xFF ;
13221322 * buffer ++ = DUSB_VPKT_PING >> 0 & 0xFF ;
13231323
1324+ const bool is_os = (context -> state == DUSB_OS_PING_WAIT_STATE || context -> state == DUSB_OS_PING_STATE );
13241325 * buffer ++ = 0 ;
1325- * buffer ++ = context -> state == DUSB_OS_PING_STATE ? 2 : 3 ;
1326+ * buffer ++ = is_os ? 2 : 3 ;
13261327 * buffer ++ = 0 ;
13271328 * buffer ++ = 1 ;
13281329 * buffer ++ = 0 ;
13291330 * buffer ++ = 0 ;
13301331 * buffer ++ = 0 ;
13311332 * buffer ++ = 0 ;
1332- * buffer ++ = context -> state == DUSB_OS_PING_STATE ? 0x0F : 0x07 ;
1333- * buffer ++ = context -> state == DUSB_OS_PING_STATE ? 0xA0 : 0xD0 ;
1333+ * buffer ++ = is_os ? 0x0F : 0x07 ;
1334+ * buffer ++ = is_os ? 0xA0 : 0xD0 ;
13341335 break ;
1336+ }
13351337 case DUSB_OS_MODE_SET_WAIT_STATE :
13361338 case DUSB_VAR_MODE_SET_WAIT_STATE :
13371339 if (buffer [4 ] == DUSB_RPKT_VIRT_DATA_LAST &&
You can’t perform that action at this time.
0 commit comments