Project

General

Profile

Diag » History » Revision 10

Revision 9 (laforge, 12/17/2016 11:08 AM) → Revision 10/16 (laforge, 12/17/2016 11:13 AM)

{{>toc}} 

 h1. Diag 

 FIXME 

 h2. Acronyms 

 |DCI|Diag Consumer Interface| 

 h2. Child Pages 

 {{child_pages()}} 

 h2. Subsystems 

 h3. Logging 

 Logging works by so-called log-codes.    The Log code identifies the source/category of the logged information.    Log codes are 16bit unsigned integers. 

 |_.Base Code|_.Purpose| 
 |0x1000|CDMA 1x| 
 |0x4000|WCDMA| 
 |0x5000|GSM| 
 |0x6000|Location Based Services| 
 |0x7000|UMTS| 
 |0x8000|TDMA| 
 |0xA000|DTV| 
 |0xB000|APPS| 
 |0xB010|LTE (until 0xB1FF)| 
 |0xB400|WIMAX| 
 |0xC000|DSP| 
 |0xD000|TD-SCDMA (until 0xD1FF)| 
 |0xF000|LOG TOOLS| 

 h2. Kernel support 

 See [[Qualcomm_Kernel#diag]] 

 h2. Library 

 There is @/usr/lib/libdiag.so.1@ which is linked by virtually any Qualcomm or Quectel proprietary program running on the Linux in the Modem. 

 it offers the follwing symbols: 
 <pre> 
 log_submit 
 pools 
 diag_vote_md_real_time 
 DiagSvc_Free 
 diag_dci_get_real_time_status_proc 
 diagpkt_subsys_get_delayed_rsp_id 
 diagpkt_subsys_alloc_v2 
 diag_read_mask_file_list 
 diagpkt_subsys_get_cmd_code 
 Diag_LSM_Event_DeInit 
 diag_wakelock_init 
 mask_file2 
 cleanup_mask 
 diag_register_dci_client 
 mask_file 
 msg_send_var 
 diagpkt_subsys_alloc_v2_delay 
 log_to_memory 
 diagpkt_alloc 
 db_thread_initialized 
 _init 
 stop_cond 
 diag_hdlc_toggle 
 diag_wakelock_acquire 
 parser_state 
 num_bytes_read 
 log_update_dci_mask 
 send_mask_modem 
 qsr4_db_file_fd 
 qsr4_db_write_buf_pool 
 event_update_mask 
 mask_sync_initialize 
 file_name_curr 
 msg_sprintf 
 mask_file_mdm2 
 event_report_payload 
 DiagSvc_Malloc_Init 
 diag_release_dci_client 
 update_sync_mask 
 diag_send_socket_data 
 diag_register_dci_stream_proc 
 DiagSvc_Malloc 
 buffer_init 
 msg_mask_tbl_size 
 curr_write_idx 
 diag_logger_flush 
 pool0_buffers 
 log_set_length 
 hdlc_disabled 
 fd_qsr4_xml 
 qsr4_xml_file_name 
 diagpkt_LSM_process_request 
 diag_get_real_time_status 
 Diag_LSM_Pkt_DeInit 
 flush_buffer 
 diag_callback_send_data 
 dci_cumulative_event_mask 
 dci_transaction_id 
 diag_get_health_stats_proc 
 stop_mutex 
 diag_get_health_stats 
 log_free 
 mask_file_mdm 
 diagpkt_subsys_reset_delayed_rsp_id 
 diag_logger_init 
 dummy_handler 
 diag_send_data 
 diag_kill_qshrink4_threads 
 ts_get_lohi 
 diagpkt_subsys_set_rsp_cnt 
 diag_notify_parser_thread 
 diag_disable_all_logs 
 diagpkt_commit 
 proc_type 
 diag_log_stream_config 
 log_status 
 msg_send 
 WriteToDisk 
 Diag_LSM_Log_DeInit 
 fd_dev 
 diag_dci_get_real_time_status 
 qsr4_db_cmd_req_buf 
 diagpkt_subsys_alloc 
 get_sync_mask 
 diag_get_dci_support_list_proc 
 diag_get_real_time_status_proc 
 qsr4_read_db_mutex 
 dir_name 
 diag_set_socket_fd 
 diag_switch_logging_proc 
 diagpkt_get_cmd_code 
 diagpkt_subsys_get_status 
 in_read 
 Diag_LSM_Event_Init 
 diag_dci_error_type 
 diag_disable_all_events 
 pid_file 
 qsr4_db_parser_thread_hdl 
 num_dci_proc 
 in_wait_for_peripheral_status 
 write_in_progress 
 Diag_LSM_Pkt_Init 
 max_file_size 
 ts_get 
 diag_get_event_status 
 log_set_timestamp 
 curr_read 
 diag_register_dci_signal_data 
 diagpkt_shorten 
 curr_read_idx 
 pool1_buffers 
 lookup_pkt_rsp_transaction 
 diag_disable_console 
 max_file_num 
 diag_send_dci_async_req 
 log_get_length 
 diagpkt_set_cmd_code 
 diagpkt_subsys_set_status 
 diag_peripheral_buffering_drain_immediate 
 event_mask 
 log_commit 
 min_file_size 
 gdwClientID 
 msg_send_ts 
 read_thread_hdl 
 valid_token 
 add_guid_to_qshrink4_header 
 msg_mask 
 file_list_size 
 log_shorten 
 diagpkt_free 
 fd_socket 
 flush_log 
 create_diag_qshrink4_db_parser_thread 
 diag_read_mask_file 
 diag_deregister_dci_signal_data 
 num_dci_clients_event 
 proc_name 
 diag_lsm_dci_deinit 
 diag_wakelock_release 
 read_buffer 
 diagpkt_subsys_get_id 
 peripheral_name 
 Diag_LSM_Init 
 diag_configure_peripheral_buffering_tx_mode 
 curr_write 
 diag_callback_send_data_hdlc 
 qsr_msg_send_1 
 qsr_msg_send_2 
 db_write_thread_hdl 
 Diag_LSM_Msg_Init 
 qsr_msg_send_3 
 token_list 
 diag_has_remote_device 
 diag_register_remote_callback 
 in_write 
 file_list 
 process_incoming_data 
 delete_log 
 log_to_device 
 logging_mode 
 log_set_code 
 diagpkt_delay_commit 
 flush_in_progress 
 diag_send_to_output 
 diag_get_max_channels 
 Diag_LSM_Log_Init 
 file_name_del 
 uart_logging_proc 
 DiagSvc_Malloc_Exit 
 output_dir 
 diag_event_stream_config 
 Diag_LSM_DeInit 
 diagpkt_tbl_reg 
 diag_dci_vote_real_time 
 kill_thread 
 count_written_bytes_1 
 qsr_msg_send 
 event_report 
 diag_fd 
 event_update_dci_mask 
 diag_get_dci_support_list 
 log_update_mask 
 parse_data_for_qsr4_db_file_op_rsp 
 file_list_index 
 rename_file_names 
 diag_register_callback 
 diag_lsm_dci_init 
 diag_vote_md_real_time_proc 
 msg_send_1 
 msg_send_2 
 msg_send_3 
 diag_is_wakelock_init 
 disk_write_hdl 
 diag_register_socket_cb 
 msg_update_mask 
 diag_set_peripheral_mask 
 log_alloc 
 dci_client_tbl 
 do_mask_sync 
 write_qshrink_header 
 fd_uart 
 qsr_msg_send_var 
 periph_info 
 diag_logger_exit 
 send_empty_mask 
 gnDiag_LSM_Event_Initialized 
 diagpkt_err_rsp 
 diag_logger_write 
 diag_get_log_status 
 qsr4_read_db_cond 
 rename_dir_name 
 diag_wakelock_destroy 
 diag_register_dci_stream 
 log_get_code 
 msg_mask_tbl 
 Diag_LSM_Msg_DeInit 
 to_integer 
 _fini 
 diag_get_peripheral_name_from_mask 
 count_written_bytes 
 diag_switch_logging 
 fd_md 
 </pre> 

 h3. Initialization 

 |_.Function|_.Purpose| 
 |Diag_LSM_Init()|Registering with Diag which gives the client a handle to the Diag. Called once per process| 

 h3. Logging Service API 

 This is about sending log messages via the Diag interface. 

 |_.Function|_.Purpose| 
 |log_alloc(u16 code, len)|Allocate a buffer + fill header| 
 |log_shorten(ptr, len)|Shorten the length of a previously allocated buffer| 
 |log_commit(ptr)|Send the log to diag| 
 |log_free(ptr)|Free a buffer previously allocated with log_alloc()| 
 |log_submit(ptr)|Convenience wrapper around log_alloc()/memcpy()/log_commit()| 

 On the [[EC25]], it seems only the following Linux programs use the avove API to generate logs via Diag: 
 * @/usr/bin/cnss_diag@ 
 * @/usr/bin/ftmdaemon@ 
 * @/usr/bin/mbimd@ 
 * @/usr/bin/test_diag@ 

 

 h3. Diag Consumer Interface 

 This seems to be about implementing a program that consumes Diag events. You can register to certain events/masks and then receive the related information in call-backs. 

 |_.Function|_.Description| 
 |diag_lsm_dci_init()|Initialize DCI subsystem of libdiag| 
 |diag_register_dci_client()|Register a DCI client| 
 |diag_get_dci_support_list()|Get list of peripherals supported| 
 |diag_register_dci_stream()|Register call-backs for events and logs| 
 |diag_event_stream_config()|Set up event streaming to the client| 
 |diag_log_stream_config()|Specify array of requested log codes| 
 |diag_get_health_stats()|Get statistics about missed/succeeded logs and events| 
 |diag_register_dci_signal_data()|Request OS signal when DCI data is received|
Add picture from clipboard (Maximum size: 48.8 MB)