?? unplug_test.c
字號:
0x01, 0x00, 0xff, 0xff, 0x00, 0xff, 0x35, 0x09, 0x09, 0x00, 0x01, 0x09, 0x00, 0x04, 0x09, 0x01, 0x00, 0x00 }; return sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5);}static s32 spp_test_55113(void){ /* Establish a L2CAP channel on PSM 1 (SDP) before doing this test */ unsigned char sdp_query[] = { 0x06, 0x88, 0x88, 0x00, 0x13, 0x35, 0x03, 0x19, 0x12, 0x34, 0x00, 0xff, 0x35, 0x09, 0x09, 0x00, 0x01, 0x09, 0x00, 0x04, 0x09, 0x01, 0x00, 0x00 }; return sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5);}static s32 spp_test_56211(void){ /* Run the hci_write_encryption_mode(1) in hci_init */ return 0;}/* * RFCOMM stuff */static s32 test_4_1(void){ /* Create a connection */ printk("Please use rf_conn server channel 2\n"); return 0;}static s32 test_4_2_1(void){ /* Send stop flow command on dlci 4*/ printk("test_4_2\n"); return rfcomm_msc_msg(&rfcomm_con_list[0], 0x87 ,MCC_CMD, 4);}static s32 test_4_2_2(void){ /* Send start flow command on dlci 4 */ printk("test_4_2\n"); return rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 4);}static s32 test_4_2_3(void){ /* Send start flow command on dlci 4 */ printk("test_4_2\n"); return rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 3);}static s32 test_4_2_4(void){ /* Send start flow command on dlci 4 */ printk("test_4_2\n"); return rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 2);}static s32 test_4_3(void){ s32 retval = 0; /* Here we should send data after we received a flow stop command */ printk("test_4_3\n"); if ((retval = rfcomm_send_data(CREATE_RFCOMM_ID(0,4),testdata, 1024)) < 0) { D_ERR("rfcomm_send_data: Failed\n"); } return retval;}static s32 test_4_4(void){ /* If we should initiate the disconnection we do this */ printk("test_4_4\n"); return rfcomm_disconnect_req(0);}static s32 test_4_5_1(void){ printk("test_4_5_1\n"); return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 1);}static s32 test_4_5_2(void){ s32 retval = 0; printk("test_4_5_2\n"); rpn_val.rtr_input = 1; rpn_val.rtr_output = 1; rpn_val.pm.rtr_input = 1; rpn_val.pm.rtr_output = 1; retval = rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 0); rpn_val.pm.rtr_input = 0; rpn_val.pm.rtr_output = 0; return retval;}static s32 test_4_6(void){ u8 data[1]; printk("test_4_6\n"); data[0] = 'b'; /* We send a test messages of one byte size */ return rfcomm_test_msg(&rfcomm_con_list[0], data, 1, MCC_CMD);}static s32 test_4_7(void){ printk("test_4_7\n"); return rfcomm_rls_msg(&rfcomm_con_list[0], MCC_CMD, 4, 0x03);}static s32 test_4_8_1(void){ /* Here we send a fcoff command */ printk("test_4_8\n"); return rfcomm_fcoff_msg(&rfcomm_con_list[0], MCC_CMD);}static s32 test_4_8_2(void){ /* Here we send a fcon command */ printk("test_4_8\n"); return rfcomm_fcon_msg(&rfcomm_con_list[0], MCC_CMD);}static s32 test_4_9(void){ /* Test to send data after received fcoff command */ printk("test_4_9\n"); return test_4_3();}static s32 test_4_10(void){ /* Create a connection on serverchannel one */ printk("Please use rfcomm_connect server channel 1, line 0 instead\n"); return 0;}static s32 test_4_11(void){ /* Same as test 4.10, but here we should be the responder */ printk("test_4_11\n"); return test_4_10();}static s32 test_4_12(void){ printk("test_4_12\n"); return test_4_4();}static s32 test_4_13(void){ printk("test_4_13\n"); return rfcomm_set_mtu(&rfcomm_con_list[0], 4, 500); printk("MTU set to 500\n"); printk("Please use rfcomm_connect server channel 2, line 0 to connect\n");}static s32 test_4_14(void){ printk("test_4_14\n"); printk("PLease use rfcomm_conn on serverchannel 4\n"); return 0;}static s32 test_4_15(void){ printk("test_4_15\n"); return rfcomm_crap_msg(&rfcomm_con_list[0]);}static s32 test_4_16(void){ printk("test_4_16\n"); return rfcomm_msc_msg(&rfcomm_con_list[0], 0x8d ,MCC_CMD, 8);}static s32 test_4_21_1(void){ printk("test_4_21_1\n"); return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 1);}static s32 test_4_21_2(void){ s32 retval = 0; printk("test_4_21_2\n"); rpn_val.rtr_input = 1; rpn_val.rtr_output = 1; rpn_val.pm.rtr_input = 1; rpn_val.pm.rtr_output = 1; retval = rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 0); rpn_val.pm.rtr_input = 0; rpn_val.pm.rtr_output = 0; return retval;}static s32 test_4_22_1(void){ s32 retval = 0; printk("test_4_22_1\n"); rpn_val.rtr_input = 1; rpn_val.rtr_output = 1; rpn_val.pm.rtr_input = 1; rpn_val.pm.rtr_output = 1; retval = rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 0); rpn_val.pm.rtr_input = 0; rpn_val.pm.rtr_output = 0; return retval;}static s32 test_4_22_2(void){ printk("test_4_22_2\n"); return rfcomm_sabm_msg(&rfcomm_con_list[0], 2);;}static s32 test_4_22_3(void){ printk("test_4_21_1\n"); return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 1);}static s32 test_4_23_1(void){ printk("test_4_23_1\n"); return test_4_22_1();}static s32 test_4_23_2(void){ printk("test_4_23_2\n"); return rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 127);}static s32 test_4_23_3(void){ printk("test_4_23_2\n"); return rfcomm_sabm_msg(&rfcomm_con_list[0], 2);}static s32 test_4_23_4(void){ printk("test_4_23_1\n"); return test_4_22_3();}static s32 test_4_24_1(void){ printk("test_4_23_1\n"); return test_4_23_2();}static s32 test_4_24_2(void){ printk("test_4_23_2\n"); return test_4_23_1();}static s32 test_4_24_3(void){ printk("test_4_23_2\n"); return rfcomm_sabm_msg(&rfcomm_con_list[0], 2);}static s32 test_4_24_4(void){ printk("test_4_23_1\n"); return rfcomm_sabm_msg(&rfcomm_con_list[0], 2);}static s32 test_4_25_1(void){ printk("test_4_25_1\n"); return rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 500);}static s32 test_4_25_2(void){ printk("test_4_25_2\n"); rfcomm_con_list[0].l2cap->local_mtu = 65; return 0;}static s32 test_4_25_3(void){ printk("test_4_25_3\n"); return rfcomm_sabm_msg(&rfcomm_con_list[0], 2);}static s32 test_4_26(void){ printk("test_4_26\n"); return rfcomm_pn_msg(&rfcomm_con_list[0], 4, 0, 127);}static s32 test_4_27(void){ printk("test_4_27\n"); return rfcomm_pn_msg(&rfcomm_con_list[0], 4, 10, 127);}static s32 test_4_28(void){ printk("test_4_28\n"); return rfcomm_send_credits(&rfcomm_con_list[0], 4, 10);}/* * TCS stuff */static s32 test_5_1(void){ if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); return -1; } return tcs_setup(tcs[0].l2cap, NULL, 0);}static s32 test_5_1_1(void){ u8 nbr[2]; if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); return -1; } nbr[0] = '0'; nbr[1] = '4'; nbr[2] = '6'; nbr[3] = '7'; nbr[4] = '0'; nbr[5] = '8'; nbr[6] = '7'; nbr[7] = '1'; nbr[8] = '4'; nbr[9] = '5'; nbr[10] = '7'; nbr[11] = '2'; return tcs_setup(tcs[0].l2cap, nbr, 12);}static s32 test_5_2(void){ if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); return -1; } return tcs_connect(tcs[0].l2cap);}static s32 test_5_3(void){ if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); return -1; } return tcs_disconnect(tcs[0].l2cap);}static s32 test_5_4(void){ return test_5_1();}static s32 test_5_5(void){ return test_5_2();}static s32 test_5_6(void){ return test_5_3();}static s32 test_5_7(void){ if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); return -1; } return tcs_send_information(tcs[0].l2cap, '1');}static s32 test_gateway_call(void){ unsigned char *atd = "ATD4257272353\r\n"; printk("test_gateway_call, sending %s\n", atd); return rfcomm_send_data(CREATE_RFCOMM_ID(0,2), atd, strlen(atd));}s32 process_test_cmd(s32 test_case){ if (!test_is_initialized) { unplug_test_init(); } printk("test_case %d\n",test_case); switch (test_case) { case 0: return test_server(); case 1: return test_client(); case 221: return test_2_2_1(); case 222: return test_2_2_2(); case 223: return test_2_2_3(); case 224: return test_2_2_4(); case 225: return test_2_2_5(); case 226: return test_2_2_6(); case 23: return test_2_3(); case 251: return test_2_5_1(); case 252: return test_2_5_2(); case 253: return test_2_5_3(); case 254: return test_2_5_4(); case 255: return test_2_5_5(); case 256: return test_2_5_6(); case 261: return test_2_6_1(); case 272: return test_2_7_2(); case 281: return test_2_8_1(); case 282: return test_2_8_2(); case 283: return test_2_8_3(); case 284: return test_2_8_4(); case 291: return test_2_9_1(); case 292: return test_2_9_2(); case 210: return test_2_10(); case 2131 : return test_2_13_1(); case 52111: return sdp_test_52111(); case 52113: return sdp_test_52113(); case 52114: return sdp_test_52114(); case 52121: return sdp_test_52121(); case 52122: return sdp_test_52122(); case 53111: return sdp_test_53111(); case 53113: return sdp_test_53113(); case 53114: return sdp_test_53114(); case 53115: return sdp_test_53115(); case 53118: return sdp_test_53118(); case 531110: return sdp_test_531110(); case 531117: return sdp_test_531117(); case 531120: return sdp_test_531120(); case 53121: return sdp_test_53121(); case 53122: return sdp_test_53122(); case 53123: return sdp_test_53123(); case 54111: return sdp_test_54111(); case 54112: return sdp_test_54112(); case 54113: return sdp_test_54113(); case 54114: return sdp_test_54114(); case 54116: return sdp_test_54116(); case 541110: return sdp_test_541110(); case 541111: return sdp_test_541111(); case 541112: return sdp_test_541112(); case 541120: return sdp_test_541120(); case 54121: return sdp_test_54121(); case 54122: return sdp_test_54122(); case 55111: return sdp_test_55111(); case 55112: return sdp_test_55112(); case 62211: return spp_test_52211(); case 62311: return spp_test_52311(); case 62312: return spp_test_52312(); case 62313: return spp_test_52313(); case 62314: return spp_test_52314(); case 63112: return spp_test_53112(); case 63211: return spp_test_53211(); case 63312: return spp_test_53312(); case 63411: return spp_test_53411(); case 63412: return spp_test_53412(); case 63511: return spp_test_53511(); case 63611: return spp_test_53611(); case 63711: return spp_test_53711(); case 63811: return spp_test_53811(); case 63911: return spp_test_53911(); case 631011: return spp_test_531011(); case 631111: return spp_test_531111(); case 631112: return spp_test_531112(); case 66211: return spp_test_56211(); case 41: return test_4_1(); case 421: return test_4_2_1(); case 422: return test_4_2_2(); case 423: return test_4_2_3(); case 424: return test_4_2_4(); case 43: return test_4_3(); case 44: return test_4_4(); case 451: return test_4_5_1(); case 452: return test_4_5_2(); case 46: return test_4_6(); case 47: return test_4_7(); case 481: return test_4_8_1(); case 482: return test_4_8_2(); case 49: return test_4_9(); case 410: return test_4_10(); case 411: return test_4_11(); case 412: return test_4_12(); case 413: return test_4_13(); case 414: return test_4_14(); case 415: return test_4_15(); case 416: return test_4_16(); case 4211: return test_4_21_1(); case 4212: return test_4_21_2(); case 4221: return test_4_22_1(); case 4222: return test_4_22_2(); case 4223: return test_4_22_3(); case 4231: return test_4_23_1(); case 4232: return test_4_23_2(); case 4233: return test_4_23_3(); case 4234: return test_4_23_4(); case 4241: return test_4_24_1(); case 4242: return test_4_24_2(); case 4243: return test_4_24_3(); case 4244: return test_4_24_4(); case 4251: return test_4_25_1(); case 4252: return test_4_25_2(); case 426: return test_4_26(); case 427: return test_4_27(); case 428: return test_4_28(); case 51: return test_5_1(); case 511: return test_5_1_1(); case 52: return test_5_2(); case 53: return test_5_3(); case 54: return test_5_4(); case 55: return test_5_5(); case 56: return test_5_6(); case 57: return test_5_7(); case 100: return test_gateway_call(); default: printk("Unknown test case\n"); return -1; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -