static void simcard_detect_work(struct work_struct *work) { int code = simcard_search(gp_sim_detect); if(SIM_IN == gp_sim_detect->cur_simcard_status){ if (SIM_OUT == code) { printk("simcard pulled out.\n"); gp_sim_detect->cur_simcard_status = SIM_OUT ; start_count_timer = 1 ; } else if(start_count_timer > 0){ in_count++ ; } } else{ if(SIM_IN == code){ printk("simcard pushed in.\n"); gp_sim_detect->cur_simcard_status = SIM_IN ; start_count_timer = 1 ; } else if(start_count_timer > 0){ out_count++ ; } } }
static void simcard_detect_work(struct work_struct *work) { int code = simcard_search(gp_sim_detect); if(SIM_IN == gp_sim_detect->cur_simcard_status){ if (SIM_OUT == code) { printk("simcard pulled out.\n"); gp_sim_detect->cur_simcard_status = SIM_OUT ; switch_set_state(&sdev, SIM_OUT); } } else{ if(SIM_IN == code){ printk("simcard pushed in.\n"); gp_sim_detect->cur_simcard_status = SIM_IN ; switch_set_state(&sdev, SIM_IN); } } }