Index: ep.bat
===================================================================
--- /1306ac/branch/dongle/usb_1M_YeCai/ep.bat	(revision 757)
+++ /1306ac/branch/dongle/usb_1M_YeCai/ep.bat	(working copy)
@@ -1,12 +1,14 @@
-call do eep
+call do.bat eep
 e pu
 e 8043 00
-e er 0 10
-e 8070 3e6c6d
-e 8070l10
-set eepage=32  
-e ew 0 11223344
-e er 0 10
+e 8070 0000000000000000
+e 8078 0000000000
+e 807a 6d
+e 807b 6c
+e 8073 3e
+e er 0 80
+e ew 0 1122
+e er 0 80
 e ep
-e er 0 10
+e er 0 80
 e ku
\ No newline at end of file
Index: output/eeprom.dat
===================================================================
--- /1306ac/branch/dongle/usb_1M_YeCai/output/eeprom.dat	(revision 757)
+++ /1306ac/branch/dongle/usb_1M_YeCai/output/eeprom.dat	(working copy)
@@ -2,36 +2,40 @@
 02
 aa
 55
-42
+c6
 03
 c2
 84
 00
-08
+09
 c0
 00
 00
-13
+14
 c0
 0c
 00
-10
+11
 c0
 17
 80
-23
+24
+c0
+38
+00
+50
 c0
 61
 00
-4f
+70
 c0
 61
 80
-27
+28
 c0
 64
 00
-37
+38
 20
 20
 3a
@@ -43,27 +47,27 @@
 c0
 23
 00
-87
+a8
 c0
 23
 80
-93
+b4
 c0
 24
 80
-b1
+d2
 c0
 26
 80
-6e
+8f
 c0
 27
 80
-18
+19
 c0
 28
 00
-63
+84
 20
 20
 3a
@@ -111,7 +115,7 @@
 20
 40
 00
-1c
+1d
 20
 20
 4a
@@ -231,7 +235,7 @@
 c0
 01
 80
-3a
+3b
 20
 20
 71
@@ -259,7 +263,7 @@
 c0
 00
 00
-41
+42
 20
 20
 72
@@ -320,6 +324,134 @@
 20
 74
 20
+58
+00
+50
+cc
+67
+e1
+45
+2b
+58
+00
+51
+b4
+67
+e1
+45
+2f
+58
+00
+51
+c5
+67
+e1
+45
+31
+58
+00
+00
+58
+20
+20
+50
+bf
+6f
+e0
+c4
+d4
+c0
+00
+80
+5b
+c0
+01
+00
+5e
+6f
+e0
+c5
+dd
+c2
+80
+51
+9d
+20
+20
+00
+60
+6f
+e0
+c5
+dd
+c2
+80
+d1
+a1
+6f
+e0
+c5
+5c
+c0
+00
+80
+64
+c0
+01
+80
+6c
+20
+60
+00
+00
+70
+45
+5c
+01
+6f
+e0
+c5
+61
+c1
+00
+00
+00
+6f
+e0
+c5
+5b
+24
+7a
+00
+00
+20
+40
+49
+fd
+24
+77
+80
+00
+20
+20
+49
+84
+6f
+e0
+c4
+44
+c0
+00
+c9
+84
+c0
+7f
+c9
+84
+20
+20
+51
+af
 6f
 f0
 8c
@@ -343,7 +475,7 @@
 20
 40
 80
-5d
+7e
 6f
 f0
 8c
@@ -381,13 +513,13 @@
 87
 97
 c0
-30
-00
+40
+80
 34
 20
 20
 00
-4a
+4b
 6f
 e0
 87
@@ -399,7 +531,7 @@
 20
 20
 00
-4a
+4b
 6f
 e0
 c5
@@ -411,7 +543,7 @@
 20
 40
 00
-67
+88
 20
 20
 4b
@@ -563,7 +695,7 @@
 20
 40
 00
-8d
+ae
 20
 20
 49
@@ -607,11 +739,11 @@
 c0
 11
 00
-99
+ba
 c0
 7f
 80
-c6
+e7
 20
 60
 00
@@ -623,7 +755,7 @@
 20
 3a
 00
-9f
+c0
 6f
 e2
 45
@@ -647,11 +779,11 @@
 c0
 00
 80
-a3
+c4
 c0
 01
 00
-aa
+cb
 20
 60
 00
@@ -671,7 +803,7 @@
 c0
 01
 00
-a8
+c9
 20
 60
 00
@@ -699,7 +831,7 @@
 c0
 80
 00
-af
+d0
 20
 60
 00
@@ -719,7 +851,7 @@
 c0
 00
 80
-b6
+d7
 c0
 01
 4a
@@ -727,7 +859,7 @@
 c0
 7f
 80
-c4
+e5
 20
 20
 4a
@@ -763,7 +895,7 @@
 c0
 00
 80
-bf
+e0
 20
 20
 4a
@@ -795,7 +927,7 @@
 20
 20
 00
-c6
+e7
 6f
 e0
 c5
@@ -803,11 +935,11 @@
 c0
 00
 80
-ca
+eb
 c0
 01
 00
-cd
+ee
 20
 60
 00
@@ -836,8 +968,8 @@
 20
 4c
 16
-16
-4d
+00
+90
 aa
 55
 40
@@ -858,7 +990,7 @@
 00
 00
 00
-00
+01
 00
 00
 00
@@ -1146,7 +1278,7 @@
 aa
 aa
 55
-a4
+a5
 44
-eb
-e5
+43
+18
Index: output/program.lis
===================================================================
--- /1306ac/branch/dongle/usb_1M_YeCai/output/program.lis	(revision 757)
+++ /1306ac/branch/dongle/usb_1M_YeCai/output/program.lis	(working copy)
@@ -1,279 +1,326 @@
               include "bt_format "
               org 0x0000
-0000 c2840008 bbit1 8 ,pf_patch_ext 
-0001 c0000013 beq patch00_0 ,p_soft_reset 
-0002 c00c0010 beq patch03_0 ,p_initialize_radio_cont 
-0003 c0178023 beq patch05_7 ,p_dongle_default_init 
-0004 c061004f beq patch18_2 ,p_usb_isr 
-0005 c0618027 beq patch18_3 ,p_usb_init 
-0006 c0640037 beq patch19_0 ,p_usb_out_standard_req 
-0007 20203a8a branch assert 
+0000 c2840009 bbit1 8 ,pf_patch_ext 
+0001 c0000014 beq patch00_0 ,p_soft_reset 
+0002 c00c0011 beq patch03_0 ,p_initialize_radio_cont 
+0003 c0178024 beq patch05_7 ,p_dongle_default_init 
+0004 c0380050 beq patch0e_0 ,p_dongle_init 
+0005 c0610070 beq patch18_2 ,p_usb_isr 
+0006 c0618028 beq patch18_3 ,p_usb_init 
+0007 c0640038 beq patch19_0 ,p_usb_out_standard_req 
+0008 20203a8a branch assert 
 
 pf_patch_ext:
-0008 c17f8000 rtneq patch3f_7 
-0009 c0230087 beq patch28_6 ,p_g24_bind_data_process 
-000a c0238093 beq patch28_7 ,p_g24_bind_data_parse_next 
-000b c02480b1 beq patch29_1 ,p_g24_receive_packet_start_next 
-000c c026806e beq patch29_5 ,p_g24_mode_switch_bind_search 
-000d c0278018 beq patch29_7 ,p_g24_bind_mode_auto 
-000e c0280063 beq patch2a_0 ,p_g24_search_mode_auto 
-000f 20203a8a branch assert 
+0009 c17f8000 rtneq patch3f_7 
+000a c02300a8 beq patch28_6 ,p_g24_bind_data_process 
+000b c02380b4 beq patch28_7 ,p_g24_bind_data_parse_next 
+000c c02480d2 beq patch29_1 ,p_g24_receive_packet_start_next 
+000d c026808f beq patch29_5 ,p_g24_mode_switch_bind_search 
+000e c0278019 beq patch29_7 ,p_g24_bind_mode_auto 
+000f c0280084 beq patch2a_0 ,p_g24_search_mode_auto 
+0010 20203a8a branch assert 
 
 p_initialize_radio_cont:
-0010 708a7503 jam 0x03 ,core_rx_lna_cfg3 
-0011 708a8500 jam 0 ,core_syn_loopdiv_dsm_cfg 
-0012 20203a1e branch initialize_radio_cont + 1 
+0011 708a7503 jam 0x03 ,core_rx_lna_cfg3 
+0012 708a8500 jam 0 ,core_syn_loopdiv_dsm_cfg 
+0013 20203a1e branch initialize_radio_cont + 1 
 
 p_soft_reset:
-0013 20800000 clear_stack 
-0014 6fe240cc fetch 4 ,mem_lpm_ctrl3 
-0015 67f2004c store 4 ,core_lpm_reg 
-0016 20403c16 call lpm_write_ctrl3 
-0017 20203803 branch soft_reset + 2 
+0014 20800000 clear_stack 
+0015 6fe240cc fetch 4 ,mem_lpm_ctrl3 
+0016 67f2004c store 4 ,core_lpm_reg 
+0017 20403c16 call lpm_write_ctrl3 
+0018 20203803 branch soft_reset + 2 
 
 p_g24_bind_mode_auto:
-0018 6fe0c561 fetch 1 ,mem_24g_work_mode 
-0019 c1808000 rtnne dongle_bind 
-001a 2040001c call p_g24_bind_init 
-001b 20204ae3 branch g24_bind_mode_auto + 4 
+0019 6fe0c561 fetch 1 ,mem_24g_work_mode 
+001a c1808000 rtnne dongle_bind 
+001b 2040001d call p_g24_bind_init 
+001c 20204ae3 branch g24_bind_mode_auto + 4 
 
 p_g24_bind_init:
-001c 6fe0c560 fetch 1 ,mem_24g_mode_init 
-001d c3808000 rtnbit1 dongle_bind 
-001e 79207e01 set1 dongle_bind ,pdata 
-001f 67e0c560 store 1 ,mem_24g_mode_init 
-0020 58000000 setarg 0 
-0021 67e1c51e store 3 ,mem_24g_device1_bind_step 
-0022 20204980 branch g24_bind_init + 8 
+001d 6fe0c560 fetch 1 ,mem_24g_mode_init 
+001e c3808000 rtnbit1 dongle_bind 
+001f 79207e01 set1 dongle_bind ,pdata 
+0020 67e0c560 store 1 ,mem_24g_mode_init 
+0021 58000000 setarg 0 
+0022 67e1c51e store 3 ,mem_24g_device1_bind_step 
+0023 20204980 branch g24_bind_init + 8 
 
 p_dongle_default_init:
-0023 204050c4 call dongle_default_init + 1 
-0024 70451c94 jam tx_power_f20db ,mem_24g_pair_tx_power 
-0025 70451500 jam off ,mem_24g_disable_fec1 
-0026 202048fa branch g24_enable_1m 
+0024 204050c4 call dongle_default_init + 1 
+0025 70451c94 jam tx_power_f20db ,mem_24g_pair_tx_power 
+0026 70451500 jam off ,mem_24g_disable_fec1 
+0027 202048fa branch g24_enable_1m 
 
 p_usb_init:
-0027 20406eb3 call enable_authrom 
-0028 20407056 call usb_init_param 
-0029 708c0000 jam 0x00 ,core_usb_config 
-002a 20002710 nop 10000 
-002b 708c1800 jam 0x00 ,core_usb_trig 
-002c 6ff10050 fetch 2 ,core_clkoff 
-002d 793ffe0a set0 clock_off_usb ,pdata 
-002e 67f10050 store 2 ,core_clkoff 
-002f 708c1100 jam 0x00 ,core_usb_hmode 
-0030 708c003c jam 0x3c ,core_usb_config 
-0031 58000d00 setarg mem_usb_rxbuf_new 
-0032 67f10c03 store 2 ,core_usb_rx_saddr 
-0033 67f10c07 store 2 ,core_usb_rxptr 
-0034 58000d44 setarg mem_usb_rxbuf_new_end 
-0035 67f10c05 store 2 ,core_usb_rx_eaddr 
-0036 2020704f branch usb_init + 16 
+0028 20406eb3 call enable_authrom 
+0029 20407056 call usb_init_param 
+002a 708c0000 jam 0x00 ,core_usb_config 
+002b 20002710 nop 10000 
+002c 708c1800 jam 0x00 ,core_usb_trig 
+002d 6ff10050 fetch 2 ,core_clkoff 
+002e 793ffe0a set0 clock_off_usb ,pdata 
+002f 67f10050 store 2 ,core_clkoff 
+0030 708c1100 jam 0x00 ,core_usb_hmode 
+0031 708c003c jam 0x3c ,core_usb_config 
+0032 58000d00 setarg mem_usb_rxbuf_new 
+0033 67f10c03 store 2 ,core_usb_rx_saddr 
+0034 67f10c07 store 2 ,core_usb_rxptr 
+0035 58000d44 setarg mem_usb_rxbuf_new_end 
+0036 67f10c05 store 2 ,core_usb_rx_eaddr 
+0037 2020704f branch usb_init + 16 
 
 p_usb_out_standard_req:
-0037 6fe0870c fetch 1 ,mem_usb_setup_brequest 
-0038 c001803a beq set_feature ,p_usb0_request_set_feature 
-0039 20207102 branch usb_out_standard_req + 1 
+0038 6fe0870c fetch 1 ,mem_usb_setup_brequest 
+0039 c001803b beq set_feature ,p_usb0_request_set_feature 
+003a 20207102 branch usb_out_standard_req + 1 
 
 p_usb0_request_set_feature:
-003a 6fe08711 fetch 1 ,mem_usb_setup_blength 
-003b c0807111 bne 0 ,usb0_force_stall 
-003c 6fe08712 fetch 1 ,mem_usb_setup_blengthh 
-003d c0807111 bne 0 ,usb0_force_stall 
-003e 6fe0870b fetch 1 ,mem_usb_setup_bmrequesttype 
-003f c0000041 beq out_device ,p_usb0_request_set_feature_out_device 
-0040 2020721e branch usb0_request_set_feature + 6 
+003b 6fe08711 fetch 1 ,mem_usb_setup_blength 
+003c c0807111 bne 0 ,usb0_force_stall 
+003d 6fe08712 fetch 1 ,mem_usb_setup_blengthh 
+003e c0807111 bne 0 ,usb0_force_stall 
+003f 6fe0870b fetch 1 ,mem_usb_setup_bmrequesttype 
+0040 c0000042 beq out_device ,p_usb0_request_set_feature_out_device 
+0041 2020721e branch usb0_request_set_feature + 6 
 
 p_usb0_request_set_feature_out_device:
-0041 6fe0870d fetch 1 ,mem_usb_setup_bvalue 
-0042 c080f111 bne device_remote_wakeup ,usb0_force_stall 
-0043 20405191 call dongle_set_pc_sleep_flag 
-0044 6ff08c00 fetch 1 ,core_usb_config 
-0045 79207e07 set1 7 ,pdata 
-0046 67f08c00 store 1 ,core_usb_config 
-0047 70079f01 jam 1 ,mem_usb_remote_wakeup 
-0048 70079700 jam 0 ,mem_usb_tx_win_enable 
-0049 20207116 branch usb0_reply_zerolen 
+0042 6fe0870d fetch 1 ,mem_usb_setup_bvalue 
+0043 c080f111 bne device_remote_wakeup ,usb0_force_stall 
+0044 20405191 call dongle_set_pc_sleep_flag 
+0045 6ff08c00 fetch 1 ,core_usb_config 
+0046 79207e07 set1 7 ,pdata 
+0047 67f08c00 store 1 ,core_usb_config 
+0048 70079f01 jam 1 ,mem_usb_remote_wakeup 
+0049 70079700 jam 0 ,mem_usb_tx_win_enable 
+004a 20207116 branch usb0_reply_zerolen 
 
 p_usb_wakeup_timer_reinit:
-004a 70079e03 jam usb_sleep ,mem_usb_state 
-004b 2040742d call timer_reinit 
-004c 58001388 setarg timer_wakeup_delay 
-004d d8e0000f arg usb_timer_wakeup ,queue 
-004e 20207420 branch timer_init 
+004b 70079e03 jam usb_sleep ,mem_usb_state 
+004c 2040742d call timer_reinit 
+004d 58001388 setarg timer_wakeup_delay 
+004e d8e0000f arg usb_timer_wakeup ,queue 
+004f 20207420 branch timer_init 
+
+p_dongle_init:
+0050 580050cc setarg dongle_dispatch 
+0051 67e1452b store 2 ,mem_cb_24g_receive_process 
+0052 580051b4 setarg dongle_g24_mouse 
+0053 67e1452f store 2 ,mem_cb_24g_data_device1 
+0054 580051c5 setarg dongle_g24_kb 
+0055 67e14531 store 2 ,mem_cb_24g_data_device2 
+0056 58000058 setarg p_dongle_ackpayload_prep 
+0057 202050bf branch dongle_init + 7 
+
+p_dongle_ackpayload_prep:
+0058 6fe0c4d4 fetch 1 ,mem_24g_data_type 
+0059 c000805b beq datatype_device1 ,p_dongle_ackpayload_prep_mouse 
+005a c001005e beq datatype_device2 ,p_dongle_ackpayload_prep_keyboard 
+
+p_dongle_ackpayload_prep_mouse:
+005b 6fe0c5dd fetch 1 ,mem_dg_pc_sleep_flag 
+005c c280519d bbit1 0 ,dongle_pc_sleep_ackpayload_prep_mouse 
+005d 20200060 branch p_dongle_ackpayload_prep_end 
+
+p_dongle_ackpayload_prep_keyboard:
+005e 6fe0c5dd fetch 1 ,mem_dg_pc_sleep_flag 
+005f c280d1a1 bbit1 1 ,dongle_pc_sleep_ackpayload_prep_keyboard 
+
+p_dongle_ackpayload_prep_end:
+0060 6fe0c55c fetch 1 ,mem_24g_ackpayload_enable 
+0061 c0008064 beq bind_ackpayload ,p_dongle_g24_bind_ackpayload_prep 
+0062 c001806c beq kb_led_ackpayload ,p_dongle_g24_kb_led_ackpayload_prep 
+0063 20600000 rtn 
+
+p_dongle_g24_bind_ackpayload_prep:
+0064 70455c01 jam 1 ,mem_24g_ackpayload_enable 
+0065 6fe0c561 fetch 1 ,mem_24g_work_mode 
+0066 c1000000 rtneq dongle_work 
+0067 6fe0c55b fetch 1 ,mem_24g_pair_mode 
+0068 247a0000 nrtn blank 
+0069 204049fd call g24_binding_device_check + 4 
+006a 24778000 nrtn user3 
+006b 20204984 branch g24_bind_ackpayload_prep + 1 
+
+p_dongle_g24_kb_led_ackpayload_prep:
+006c 6fe0c444 fetch 1 ,mem_24g_rxbuf + 2 
+006d c000c984 beq datatype_device1 ,g24_bind_ackpayload_prep + 1 
+006e c07fc984 beq datatype_attemp ,g24_bind_ackpayload_prep + 1 
+006f 202051af branch dongle_g24_kb_led_ackpayload_prep + 3 
 
 p_usb_isr:
-004f 6ff08c23 fetch 1 ,core_usb_status 
-0050 2feffe03 isolate1 usb_status_reset ,pdata 
-0051 2040f03f call usb_init ,true 
-0052 6ff08c23 fetch 1 ,core_usb_status 
-0053 2feffe01 isolate1 usb_status_suspend ,pdata 
-0054 2040805d call p_usb_set_suspend ,true 
-0055 6ff08c23 fetch 1 ,core_usb_status 
-0056 67f08c23 store 1 ,core_usb_status 
-0057 67e0855e store 1 ,mem_usb_status 
-0058 2040709a call usb_nak_state_judge 
-0059 204070c1 call usb_rx 
-005a 204072d2 call usb0_tx 
-005b 2040731a call usb_tx 
-005c 20207092 branch usb_nak_state 
+0070 6ff08c23 fetch 1 ,core_usb_status 
+0071 2feffe03 isolate1 usb_status_reset ,pdata 
+0072 2040f03f call usb_init ,true 
+0073 6ff08c23 fetch 1 ,core_usb_status 
+0074 2feffe01 isolate1 usb_status_suspend ,pdata 
+0075 2040807e call p_usb_set_suspend ,true 
+0076 6ff08c23 fetch 1 ,core_usb_status 
+0077 67f08c23 store 1 ,core_usb_status 
+0078 67e0855e store 1 ,mem_usb_status 
+0079 2040709a call usb_nak_state_judge 
+007a 204070c1 call usb_rx 
+007b 204072d2 call usb0_tx 
+007c 2040731a call usb_tx 
+007d 20207092 branch usb_nak_state 
 
 p_usb_set_suspend:
-005d 6fe08797 fetch 1 ,mem_usb_tx_win_enable 
-005e c0300034 beq p_usb_set_suspend_win ,blank 
-005f 2020004a branch p_usb_wakeup_timer_reinit 
+007e 6fe08797 fetch 1 ,mem_usb_tx_win_enable 
+007f c0408034 beq p_usb_set_suspend_win ,blank 
+0080 2020004b branch p_usb_wakeup_timer_reinit 
 
 p_usb_set_suspend_win:
-0060 6fe0879f fetch 1 ,mem_usb_remote_wakeup 
-0061 207a0000 rtn blank 
-0062 2020004a branch p_usb_wakeup_timer_reinit 
+0081 6fe0879f fetch 1 ,mem_usb_remote_wakeup 
+0082 207a0000 rtn blank 
+0083 2020004b branch p_usb_wakeup_timer_reinit 
 
 p_g24_search_mode_auto:
-0063 6fe0c561 fetch 1 ,mem_24g_work_mode 
-0064 c1838000 rtnne dongle_search 
-0065 20400067 call p_g24_search_mode_init 
-0066 20204b00 branch g24_search_mode_auto + 4 
+0084 6fe0c561 fetch 1 ,mem_24g_work_mode 
+0085 c1838000 rtnne dongle_search 
+0086 20400088 call p_g24_search_mode_init 
+0087 20204b00 branch g24_search_mode_auto + 4 
 
 p_g24_search_mode_init:
-0067 6fe0c560 fetch 1 ,mem_24g_mode_init 
-0068 c3838000 rtnbit1 dongle_search 
-0069 79207e07 set1 dongle_search ,pdata 
-006a 67e0c560 store 1 ,mem_24g_mode_init 
-006b 6fe0c56e fetch 1 ,mem_tx_power_temp 
-006c 67e0c116 store 1 ,mem_tx_power 
-006d 20204af0 branch g24_search_mode_init + 4 
+0088 6fe0c560 fetch 1 ,mem_24g_mode_init 
+0089 c3838000 rtnbit1 dongle_search 
+008a 79207e07 set1 dongle_search ,pdata 
+008b 67e0c560 store 1 ,mem_24g_mode_init 
+008c 6fe0c56e fetch 1 ,mem_tx_power_temp 
+008d 67e0c116 store 1 ,mem_tx_power 
+008e 20204af0 branch g24_search_mode_init + 4 
 
 p_g24_mode_switch_bind_search:
-006e 6fe0c561 fetch 1 ,mem_24g_work_mode 
-006f c1000000 rtneq dongle_work 
-0070 6fe0c575 fetch 1 ,mem_24g_b_s_mode_switch_disable 
-0071 247a0000 nrtn blank 
-0072 6fe0c573 fetch 1 ,mem_24g_mode_b_s_switch_exit 
-0073 247a0000 nrtn blank 
-0074 6fe0c56f fetch 1 ,mem_24g_mode_b_s_switch 
-0075 207a0000 rtn blank 
-0076 6fe0c576 fetch 1 ,mem_24g_bind_device_living 
-0077 2fe00603 compare 3 ,pdata ,3 
-0078 2020cac1 branch g24_mode_b_s_switch_exit ,true 
-0079 204048be call g24_timer_check 
-007a 24740000 nrtn user 
-007b 6fe14571 fetch 2 ,mem_24g_mode_b_s_switch_cnt 
-007c 1fe0fe01 increase 1 ,pdata 
-007d 67e14571 store 2 ,mem_24g_mode_b_s_switch_cnt 
-007e d84007d0 arg 0x7d0 ,temp 
-007f 98467c00 isub temp ,null 
-0080 20214ac1 branch g24_mode_b_s_switch_exit ,positive 
-0081 6fe0c574 fetch 1 ,mem_24g_b_s_time_slice 
-0082 1fe0fe01 increase 1 ,pdata 
-0083 1fe17e01 and_into 1 ,pdata 
-0084 67e0c574 store 1 ,mem_24g_b_s_time_slice 
-0085 c0004b88 beq 0 ,g24_search_mode_enable 
-0086 20204abc branch g24_mode_switch_bind_search_next + 1 
+008f 6fe0c561 fetch 1 ,mem_24g_work_mode 
+0090 c1000000 rtneq dongle_work 
+0091 6fe0c575 fetch 1 ,mem_24g_b_s_mode_switch_disable 
+0092 247a0000 nrtn blank 
+0093 6fe0c573 fetch 1 ,mem_24g_mode_b_s_switch_exit 
+0094 247a0000 nrtn blank 
+0095 6fe0c56f fetch 1 ,mem_24g_mode_b_s_switch 
+0096 207a0000 rtn blank 
+0097 6fe0c576 fetch 1 ,mem_24g_bind_device_living 
+0098 2fe00603 compare 3 ,pdata ,3 
+0099 2020cac1 branch g24_mode_b_s_switch_exit ,true 
+009a 204048be call g24_timer_check 
+009b 24740000 nrtn user 
+009c 6fe14571 fetch 2 ,mem_24g_mode_b_s_switch_cnt 
+009d 1fe0fe01 increase 1 ,pdata 
+009e 67e14571 store 2 ,mem_24g_mode_b_s_switch_cnt 
+009f d84007d0 arg 0x7d0 ,temp 
+00a0 98467c00 isub temp ,null 
+00a1 20214ac1 branch g24_mode_b_s_switch_exit ,positive 
+00a2 6fe0c574 fetch 1 ,mem_24g_b_s_time_slice 
+00a3 1fe0fe01 increase 1 ,pdata 
+00a4 1fe17e01 and_into 1 ,pdata 
+00a5 67e0c574 store 1 ,mem_24g_b_s_time_slice 
+00a6 c0004b88 beq 0 ,g24_search_mode_enable 
+00a7 20204abc branch g24_mode_switch_bind_search_next + 1 
 
 p_g24_bind_data_process:
-0087 20404a39 call g24_rx_interrupt_clear 
-0088 20404792 call g24_receive_packet 
-0089 2437ca39 nbranch g24_rx_interrupt_clear ,user3 
-008a 20404997 call g24_bind_data_parse 
-008b 2040008d call p_g24_bind_transmit_ack 
-008c 2020498e branch g24_bind_data_process + 6 
+00a8 20404a39 call g24_rx_interrupt_clear 
+00a9 20404792 call g24_receive_packet 
+00aa 2437ca39 nbranch g24_rx_interrupt_clear ,user3 
+00ab 20404997 call g24_bind_data_parse 
+00ac 204000ae call p_g24_bind_transmit_ack 
+00ad 2020498e branch g24_bind_data_process + 6 
 
 p_g24_bind_transmit_ack:
-008d 6fe0c442 fetch 1 ,mem_24g_rxbuf 
-008e 67e0c4d4 store 1 ,mem_24g_data_type 
-008f 2040488d call g24_read_len_pid_crc 
-0090 20404a20 call g24_ackpayload_prep 
-0091 2437c7fc nbranch g24_end_of_packet ,user3 
-0092 20204a73 branch g24tx_with_ack + 1 
+00ae 6fe0c442 fetch 1 ,mem_24g_rxbuf 
+00af 67e0c4d4 store 1 ,mem_24g_data_type 
+00b0 2040488d call g24_read_len_pid_crc 
+00b1 20404a20 call g24_ackpayload_prep 
+00b2 2437c7fc nbranch g24_end_of_packet ,user3 
+00b3 20204a73 branch g24tx_with_ack + 1 
 
 p_g24_bind_data_parse_next:
-0093 6fe0c535 fetch 1 ,mem_24g_rxdata_temp + 2 
-0094 c05549a2 beq datatype_bind ,g24_bind_first_step 
-0095 c02ac9b3 beq datatype_config ,g24_bind_second_step 
-0096 c0110099 beq datatype_ok ,p_g24_bind_third_step 
-0097 c07f80c6 beq datatype_attemp ,p_g24_data_attemp 
-0098 20600000 rtn 
+00b4 6fe0c535 fetch 1 ,mem_24g_rxdata_temp + 2 
+00b5 c05549a2 beq datatype_bind ,g24_bind_first_step 
+00b6 c02ac9b3 beq datatype_config ,g24_bind_second_step 
+00b7 c01100ba beq datatype_ok ,p_g24_bind_third_step 
+00b8 c07f80e7 beq datatype_attemp ,p_g24_data_attemp 
+00b9 20600000 rtn 
 
 p_g24_bind_third_step:
-0099 6fe0c4f9 fetch 1 ,mem_24g_pair_switch 
-009a 203a009f branch p_g24_bind_third_step_skip ,blank 
-009b 6fe24537 fetch 4 ,mem_24g_rxdata_temp + 4 
-009c 684a4577 fetcht 4 ,mem_24g_transmitter_addr 
-009d 98467c00 isub temp ,null 
-009e 24628000 nrtn zero 
+00ba 6fe0c4f9 fetch 1 ,mem_24g_pair_switch 
+00bb 203a00c0 branch p_g24_bind_third_step_skip ,blank 
+00bc 6fe24537 fetch 4 ,mem_24g_rxdata_temp + 4 
+00bd 684a4577 fetcht 4 ,mem_24g_transmitter_addr 
+00be 98467c00 isub temp ,null 
+00bf 24628000 nrtn zero 
 
 p_g24_bind_third_step_skip:
-009f 6fe0c536 fetch 1 ,mem_24g_rxdata_temp + 3 
-00a0 c00080a3 beq datatype_device1 ,p_g24_bind_third_step_device1 
-00a1 c00100aa beq datatype_device2 ,p_g24_bind_third_step_device2 
-00a2 20600000 rtn 
+00c0 6fe0c536 fetch 1 ,mem_24g_rxdata_temp + 3 
+00c1 c00080c4 beq datatype_device1 ,p_g24_bind_third_step_device1 
+00c2 c00100cb beq datatype_device2 ,p_g24_bind_third_step_device2 
+00c3 20600000 rtn 
 
 p_g24_bind_third_step_device1:
-00a3 6fe0c529 fetch 1 ,mem_24g_device1_bind_disable 
-00a4 247a0000 nrtn blank 
-00a5 6fe0c51e fetch 1 ,mem_24g_device1_bind_step 
-00a6 c00100a8 beq 2 ,p_g24_bind_dvc1_step_success 
-00a7 20600000 rtn 
+00c4 6fe0c529 fetch 1 ,mem_24g_device1_bind_disable 
+00c5 247a0000 nrtn blank 
+00c6 6fe0c51e fetch 1 ,mem_24g_device1_bind_step 
+00c7 c00100c9 beq 2 ,p_g24_bind_dvc1_step_success 
+00c8 20600000 rtn 
 
 p_g24_bind_dvc1_step_success:
-00a8 70452901 jam 1 ,mem_24g_device1_bind_disable 
-00a9 202049e5 branch g24_bind_dvc1_step_success + 2 
+00c9 70452901 jam 1 ,mem_24g_device1_bind_disable 
+00ca 202049e5 branch g24_bind_dvc1_step_success + 2 
 
 p_g24_bind_third_step_device2:
-00aa 6fe0c52a fetch 1 ,mem_24g_device2_bind_disable 
-00ab 247a0000 nrtn blank 
-00ac 6fe0c51f fetch 1 ,mem_24g_device2_bind_step 
-00ad c08000af bne 0 ,p_g24_bind_dvc2_step_success 
-00ae 20600000 rtn 
+00cb 6fe0c52a fetch 1 ,mem_24g_device2_bind_disable 
+00cc 247a0000 nrtn blank 
+00cd 6fe0c51f fetch 1 ,mem_24g_device2_bind_step 
+00ce c08000d0 bne 0 ,p_g24_bind_dvc2_step_success 
+00cf 20600000 rtn 
 
 p_g24_bind_dvc2_step_success:
-00af 70452a01 jam 1 ,mem_24g_device2_bind_disable 
-00b0 202049f3 branch g24_bind_dvc2_step_success + 2 
+00d0 70452a01 jam 1 ,mem_24g_device2_bind_disable 
+00d1 202049f3 branch g24_bind_dvc2_step_success + 2 
 
 p_g24_receive_packet_start_next:
-00b1 6fe0c535 fetch 1 ,mem_24g_rxdata_temp + 2 
-00b2 c00080b6 beq datatype_device1 ,p_g24_data_device1 
-00b3 c0014a4e beq datatype_device2 ,g24_data_device2 
-00b4 c07f80c4 beq datatype_attemp ,p_g24_data_receive_attemp 
-00b5 20204a39 branch g24_rx_interrupt_clear 
+00d2 6fe0c535 fetch 1 ,mem_24g_rxdata_temp + 2 
+00d3 c00080d7 beq datatype_device1 ,p_g24_data_device1 
+00d4 c0014a4e beq datatype_device2 ,g24_data_device2 
+00d5 c07f80e5 beq datatype_attemp ,p_g24_data_receive_attemp 
+00d6 20204a39 branch g24_rx_interrupt_clear 
 
 p_g24_data_device1:
-00b6 20404a08 call g24_binding_dvc1_living 
-00b7 20404ba2 call g24_ch_timer_reinit 
-00b8 6fe0c555 fetch 1 ,mem_24g_abort_packet 
-00b9 6848c533 fetcht 1 ,mem_24g_rxdata_temp 
-00ba 284ffe03 isolate1 bit_abort ,temp 
-00bb 7920fe00 setflag true ,0 ,pdata 
-00bc 67e0c555 store 1 ,mem_24g_abort_packet 
-00bd c00080bf beq 1 ,p_g24_data_attemp_device1_abort 
-00be 20204a47 branch g24_data_device1 + 8 
+00d7 20404a08 call g24_binding_dvc1_living 
+00d8 20404ba2 call g24_ch_timer_reinit 
+00d9 6fe0c555 fetch 1 ,mem_24g_abort_packet 
+00da 6848c533 fetcht 1 ,mem_24g_rxdata_temp 
+00db 284ffe03 isolate1 bit_abort ,temp 
+00dc 7920fe00 setflag true ,0 ,pdata 
+00dd 67e0c555 store 1 ,mem_24g_abort_packet 
+00de c00080e0 beq 1 ,p_g24_data_attemp_device1_abort 
+00df 20204a47 branch g24_data_device1 + 8 
 
 p_g24_data_attemp_device1_abort:
-00bf 6fe0c529 fetch 1 ,mem_24g_device1_bind_disable 
-00c0 247a0000 nrtn blank 
-00c1 70452901 jam 1 ,mem_24g_device1_bind_disable 
-00c2 6fe2453d fetch 4 ,mem_24g_rxdata_temp + 10 
-00c3 20204c14 branch g24_store_device1_addr 
+00e0 6fe0c529 fetch 1 ,mem_24g_device1_bind_disable 
+00e1 247a0000 nrtn blank 
+00e2 70452901 jam 1 ,mem_24g_device1_bind_disable 
+00e3 6fe2453d fetch 4 ,mem_24g_rxdata_temp + 10 
+00e4 20204c14 branch g24_store_device1_addr 
 
 p_g24_data_receive_attemp:
-00c4 20404a16 call g24_bind_device_status 
-00c5 202000c6 branch p_g24_data_attemp 
+00e5 20404a16 call g24_bind_device_status 
+00e6 202000e7 branch p_g24_data_attemp 
 
 p_g24_data_attemp:
-00c6 6fe0c536 fetch 1 ,mem_24g_rxdata_temp + 3 
-00c7 c00080ca beq datatype_device1 ,p_g24_data_attemp_device1 
-00c8 c00100cd beq datatype_device2 ,p_g24_data_attemp_device2 
-00c9 20600000 rtn 
+00e7 6fe0c536 fetch 1 ,mem_24g_rxdata_temp + 3 
+00e8 c00080eb beq datatype_device1 ,p_g24_data_attemp_device1 
+00e9 c00100ee beq datatype_device2 ,p_g24_data_attemp_device2 
+00ea 20600000 rtn 
 
 p_g24_data_attemp_device1:
-00ca 6fe0c529 fetch 1 ,mem_24g_device1_bind_disable 
-00cb 247a0000 nrtn blank 
-00cc 20204c12 branch g24_data_attemp_device1 
+00eb 6fe0c529 fetch 1 ,mem_24g_device1_bind_disable 
+00ec 247a0000 nrtn blank 
+00ed 20204c12 branch g24_data_attemp_device1 
 
 p_g24_data_attemp_device2:
-00cd 6fe0c52a fetch 1 ,mem_24g_device2_bind_disable 
-00ce 247a0000 nrtn blank 
-00cf 20204c16 branch g24_data_attemp_device2 
+00ee 6fe0c52a fetch 1 ,mem_24g_device2_bind_disable 
+00ef 247a0000 nrtn blank 
+00f0 20204c16 branch g24_data_attemp_device2 
               org 0x3800
 
 start:
Index: program/patch.prog
===================================================================
--- /1306ac/branch/dongle/usb_1M_YeCai/program/patch.prog	(revision 757)
+++ /1306ac/branch/dongle/usb_1M_YeCai/program/patch.prog	(working copy)
@@ -5,6 +5,7 @@
 //	beq patch02_5,p_set_freq_tx
 	beq patch03_0,p_initialize_radio_cont
 	beq patch05_7,p_dongle_default_init
+	beq patch0e_0,p_dongle_init	
 	beq patch18_2,p_usb_isr
 	beq patch18_3,p_usb_init
 	beq patch19_0,p_usb_out_standard_req
@@ -109,6 +110,50 @@
 	arg USB_TIMER_WAKEUP,queue
 	branch timer_init
 
+p_dongle_init:
+	setarg dongle_dispatch
+	store 2,mem_cb_24g_receive_process
+	setarg dongle_g24_mouse
+	store 2,mem_cb_24g_data_device1
+	setarg dongle_g24_kb
+	store 2,mem_cb_24g_data_device2
+	setarg p_dongle_ackpayload_prep
+	branch dongle_init+7
+
+p_dongle_ackpayload_prep:
+	fetch 1,mem_24g_data_type
+	beq DATATYPE_DEVICE1,p_dongle_ackpayload_prep_mouse
+	beq DATATYPE_DEVICE2,p_dongle_ackpayload_prep_keyboard
+p_dongle_ackpayload_prep_mouse:
+	fetch 1,mem_dg_pc_sleep_flag
+	bbit1 0,dongle_pc_sleep_ackpayload_prep_mouse
+	branch p_dongle_ackpayload_prep_end
+
+p_dongle_ackpayload_prep_keyboard:
+	fetch 1,mem_dg_pc_sleep_flag
+	bbit1 1,dongle_pc_sleep_ackpayload_prep_keyboard
+p_dongle_ackpayload_prep_end:
+	fetch 1,mem_24g_ackpayload_enable
+	beq BIND_ACKPAYLOAD,p_dongle_g24_bind_ackpayload_prep
+	beq KB_LED_ACKPAYLOAD,p_dongle_g24_kb_led_ackpayload_prep
+	rtn
+
+p_dongle_g24_bind_ackpayload_prep:
+	jam 1,mem_24g_ackpayload_enable
+	fetch 1,mem_24g_work_mode
+	rtneq DONGLE_WORK
+	fetch 1,mem_24g_pair_mode
+	nrtn blank
+	call g24_binding_device_check+4	//works on auto pair only
+	nrtn user3
+	branch g24_bind_ackpayload_prep+1
+
+p_dongle_g24_kb_led_ackpayload_prep:
+	fetch 1,mem_24g_rxbuf+2
+	beq DATATYPE_DEVICE1,g24_bind_ackpayload_prep+1
+	beq DATATYPE_ATTEMP,g24_bind_ackpayload_prep+1
+	branch dongle_g24_kb_led_ackpayload_prep+3
+
 
 p_usb_isr:
 	fetch 1,core_usb_status
