@@ -2023,7 +2023,7 @@ static void cmd_force_timeout_alarm_handler(CLOCK offset, void *data)
20232023 input_state = INPUT_EXP_PROT ;
20242024 commandptr = 0 ;
20252025 alarm_unset (cmd_force_timeout_alarm );
2026- set_userport_flag (FLAG2_INACTIVE );
2026+ /* set_userport_flag(FLAG2_INACTIVE); */
20272027}
20282028
20292029static void cmd_force_timeout (void )
@@ -2035,7 +2035,7 @@ static void cmd_force_timeout(void)
20352035 wic64_log (CONS_COL_NO , "forcing timeout after %ds" , timeout );
20362036 force_timeout = 1 ;
20372037
2038- set_userport_flag (FLAG2_ACTIVE );
2038+ /* set_userport_flag(FLAG2_ACTIVE); */
20392039
20402040 if (cmd_force_timeout_alarm == NULL ) {
20412041 cmd_force_timeout_alarm = alarm_new (maincpu_alarm_context , "CMDForceTimoutAlarm" ,
@@ -2222,8 +2222,8 @@ static void do_command(void)
22222222 send_reply_revised (CLIENT_ERROR , "" , NULL , 0 , NULL );
22232223 break ;
22242224 case WIC64_CMD_REBOOT :
2225- userport_wic64_reset ();
22262225 wic64_sleep_cycles (3 * machine_get_cycles_per_second ()); /* emulated a 3s reboot */
2226+ userport_wic64_reset ();
22272227 break ;
22282228 case WIC64_CMD_SET_TRANSFER_TIMEOUT :
22292229 case WIC64_CMD_SET_REMOTE_TIMEOUT :
@@ -2391,24 +2391,23 @@ static void userport_wic64_store_pbx(uint8_t value, int pulse)
23912391 } else {
23922392 wic64_prot_state (value );
23932393 }
2394+ handshake_flag2 ();
23942395
23952396 cmd_timeout (1 );
23962397 if ((input_state == INPUT_EXP_ARGS ) &&
23972398 (commandptr == input_length )) {
2399+ cmd_timeout (0 );
23982400 wic64_log (LOG_COL_LBLUE , "command %s (len=%d/0x%x, using %s protocol)" ,
23992401 cmd2string [input_command ],
24002402 input_length , input_length ,
24012403 (wic64_protocol == WIC64_PROT_LEGACY ) ? "legacy" :
24022404 (wic64_protocol == WIC64_PROT_REVISED ) ? "revised" :
24032405 (wic64_protocol == WIC64_PROT_EXTENDED ) ? "extended" :
24042406 "unknown" );
2405- cmd_timeout (0 );
24062407 do_command ();
24072408 commandptr = input_state = input_length = 0 ;
24082409 input_command = WIC64_CMD_NONE ;
24092410 memset (commandbuffer , 0 , COMMANDBUFFER_MAXLEN );
2410- } else {
2411- handshake_flag2 ();
24122411 }
24132412 } else {
24142413 if (reply_length ) {
@@ -2570,14 +2569,8 @@ static void userport_wic64_reset(void)
25702569 if (cmd_force_timeout_alarm ) {
25712570 alarm_unset (cmd_force_timeout_alarm );
25722571 }
2573- if (flag2_alarm ) {
2574- alarm_unset (flag2_alarm );
2575- }
2576- if (cycle_alarm ) {
2577- alarm_unset (cycle_alarm );
2578- }
2572+ /* flag2 and cycle alarms need to be preserverd !*/
25792573 remote_to = wic64_remote_timeout ; /* reset to given value */
2580-
25812574 if (curl ) {
25822575 /* connection closed */
25832576 curl_easy_cleanup (curl );
0 commit comments