[FL-2493] Infrared: fix crash on invalid name. Input: cancel info in dump command. (#1153)
* Infrared: fix crash on invalid name. Input: cancel info in dump command. * FuriHal: add abort handler
This commit is contained in:
		
							parent
							
								
									cc99ce1f07
								
							
						
					
					
						commit
						b28d408b49
					
				| @ -14,14 +14,17 @@ int32_t InfraredApp::run(void* args) { | |||||||
|     if(args) { |     if(args) { | ||||||
|         std::string path = static_cast<const char*>(args); |         std::string path = static_cast<const char*>(args); | ||||||
|         std::string remote_name(path, path.find_last_of('/') + 1, path.size()); |         std::string remote_name(path, path.find_last_of('/') + 1, path.size()); | ||||||
|         remote_name.erase(remote_name.find_last_of('.')); |         auto last_dot = remote_name.find_last_of('.'); | ||||||
|         path.erase(path.find_last_of('/')); |         if(last_dot != std::string::npos) { | ||||||
|         bool result = remote_manager.load(path, remote_name); |             remote_name.erase(last_dot); | ||||||
|         if(result) { |             path.erase(path.find_last_of('/')); | ||||||
|             current_scene = InfraredApp::Scene::Remote; |             bool result = remote_manager.load(path, remote_name); | ||||||
|         } else { |             if(result) { | ||||||
|             printf("Failed to load remote \'%s\'\r\n", remote_name.c_str()); |                 current_scene = InfraredApp::Scene::Remote; | ||||||
|             return -1; |             } else { | ||||||
|  |                 printf("Failed to load remote \'%s\'\r\n", remote_name.c_str()); | ||||||
|  |                 return -1; | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -24,19 +24,15 @@ static void input_cli_dump(Cli* cli, string_t args, Input* input) { | |||||||
|     FuriPubSubSubscription* input_subscription = |     FuriPubSubSubscription* input_subscription = | ||||||
|         furi_pubsub_subscribe(input->event_pubsub, input_cli_dump_events_callback, input_queue); |         furi_pubsub_subscribe(input->event_pubsub, input_cli_dump_events_callback, input_queue); | ||||||
| 
 | 
 | ||||||
|     bool stop = false; |  | ||||||
|     InputEvent input_event; |     InputEvent input_event; | ||||||
|     while(!stop) { |     printf("Press CTRL+C to stop\r\n"); | ||||||
|  |     while(!cli_cmd_interrupt_received(cli)) { | ||||||
|         if(osMessageQueueGet(input_queue, &input_event, NULL, 100) == osOK) { |         if(osMessageQueueGet(input_queue, &input_event, NULL, 100) == osOK) { | ||||||
|             printf( |             printf( | ||||||
|                 "key: %s type: %s\r\n", |                 "key: %s type: %s\r\n", | ||||||
|                 input_get_key_name(input_event.key), |                 input_get_key_name(input_event.key), | ||||||
|                 input_get_type_name(input_event.type)); |                 input_get_type_name(input_event.type)); | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         if(cli_cmd_interrupt_received(cli)) { |  | ||||||
|             stop = true; |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     furi_pubsub_unsubscribe(input->event_pubsub, input_subscription); |     furi_pubsub_unsubscribe(input->event_pubsub, input_subscription); | ||||||
|  | |||||||
| @ -65,6 +65,10 @@ void Error_Handler(void) { | |||||||
|     furi_crash("ErrorHandler"); |     furi_crash("ErrorHandler"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void abort() { | ||||||
|  |     furi_crash("AbortHandler"); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| #ifdef USE_FULL_ASSERT | #ifdef USE_FULL_ASSERT | ||||||
| /**
 | /**
 | ||||||
|     * @brief  Reports the name of the source file and the source line number |     * @brief  Reports the name of the source file and the source line number | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 あく
						あく