问题:n块板子都是ok的,惟独一块插拔usb线不能启动pc端activesync
     
      第一感觉应该是硬件问题,但是在device上的windows目录下手动启动repllog.exe文件之后,activesync就正常了。从这里看,似乎硬件又没有问题了,至少功能上没有什么问题。
 
        先分析下repllog.exe能自动运行的原因,在usb线插拔的时候有ep0中断,之后处理SerModemIntr并在此CeEventHasOccurred (NOTIFICATION_EVENT_RS232_DETECTED, NULL);MS没有给出这个函数的具体解释,不过有这么一段话:This function is called by Windows CE and by supplied device drivers for currently supported events on the system. For example, the serial driver generates the NOTIFICATION_EVENT_RS232_DETECTED event and the GWE shutdown thread generates the NOTIFICATION_EVENT_WAKEUP event.
 
       同时在public\datasync\oak\files\datasync.db文件中有下面这样一段:
; @CESYSGEN IF DATASYNC_MODULES_REPLLOG
Record :
Field : 0001001f : "repllog.exe"
Field : 0002001f : "AppRunAtRs232Detect"
Field : 00030013 : 9
End
; @CESYSGEN ENDIF
 
       MS的help文档是这么说的:By default, Repllog.exe is set up to be notified of any Component Object Model (COM) events (NOTIFICATION_EVENT_RS232_DETECTED). If the driver sends this event, Repllog.exe starts automatically with the default parameters, as defined in the following section of Wceappsfe.db.
 
       我的理解是,driver根据需要(这里是在中断处理中)发送notification事件到GWES,再由GWES根据notification事件中的参数(这里为NOTIFICATION_EVENT_RS232_DETECTED)查找db文件并对照db文件中的0002001f项(也即这里的AppRunAtRs232Detect)去运行0001001f项中所列的可执行文件(这里也就是repllog.exe了)。
 
       回到问题,由于没有什么别的办法,先试着打印消息看看到底有没有发送了上述的事件到GWES。不过从打印的消息来看也确实有发送了相关的事件消息:
<EP0 Int>
<EP0 Int>
Test:send the message to start the repllog
但是还没有启动repllog.exe,因为一直没有见到那个连接的对话框。不过之后的一条打印消息就很奇怪了:
OEMSetAlarmTime: Year: 1601, Month: 1, Day: 1, Hour: 1, Minute: 4, second: 25 rcnr=0h
很明显出现了时间告警(可能是以前调试RTC的时候加的打印消息)。至此才想起了以前的一个帖子:wince系统时间限制系统组件。靠,那时解决的就是现在的问题,晕蛋了!