none
IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS - Command is executed multiple times during operation RRS feed

  • Question

  • Hello,

    i face connection problems with a coin sorter (TWS 100 from WH Berlin) from time to time. I use a FTDI driver to communicate with the device over USB. In some cases, the connection is lost and i can't find the device any more in the device manager. 

    I used a USB Software Sniffer in order to evaluate the connection. Hereby, i found out, that the application i am using, is sending the command "IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS" all the time in short time  intervals. For example:

    00071814              2019-10-08 16:50:00,0822569     +0,0000070          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               UP                        0x00000000                                      

    00071817              2019-10-08 16:50:00,0823386     +0,0000117          IRP_MJ_READ   UP                        0x00000000         00                         .

    00071819              2019-10-08 16:50:00,0824781     +0,0000107          IRP_MJ_READ   UP                        0x00000000         01                         .

    00071821              2019-10-08 16:50:00,0826111     +0,0000107          IRP_MJ_READ   UP                        0x00000000         fe                          .

    00071823              2019-10-08 16:50:00,0827377     +0,0000107          IRP_MJ_READ   UP                        0x00000000         fe                          .

    00071824              2019-10-08 16:50:00,0967220     +0,0139843          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               DOWN                 0x00000000         ff ff ff ff ff ff ff ff e8 03 00 00 00 00 00 00 00 00 00 00             ....................

    00071825              2019-10-08 16:50:00,0967300     +0,0000080          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               UP                        0x00000000                                      

    00071827              2019-10-08 16:50:00,0971024     +0,0000133          IRP_MJ_READ   UP                        0x00000000         01                         .

    00071828              2019-10-08 16:50:00,0974032     +0,0003008          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               DOWN                 0x00000000         ff ff ff ff ff ff ff ff 32 00 00 00 00 00 00 00 00 00 00 00             ........2...........

    00071829              2019-10-08 16:50:00,0974102     +0,0000070          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               UP                        0x00000000                                      

    00071831              2019-10-08 16:50:00,0974892     +0,0000112          IRP_MJ_READ   UP                        0x00000000         00                         .

    00071832              2019-10-08 16:50:00,0976228     +0,0001336          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               DOWN                 0x00000000         ff ff ff ff ff ff ff ff 64 00 00 00 00 00 00 00 00 00 00 00             ........d...........

    00071833              2019-10-08 16:50:00,0976292     +0,0000064          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               UP                        0x00000000                                      

    00071835              2019-10-08 16:50:00,0977051     +0,0000107          IRP_MJ_READ   UP                        0x00000000         03                         .

    00071836              2019-10-08 16:50:00,0978392     +0,0001341          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               DOWN                 0x00000000         ff ff ff ff ff ff ff ff 32 00 00 00 00 00 00 00 00 00 00 00             ........2...........

    00071837              2019-10-08 16:50:00,0978461     +0,0000069          IRP_MJ_DEVICECONTROL: IOCTL_SERIAL_SET_TIMEOUTS                               UP                        0x00000000                                      

    00071839              2019-10-08 16:50:00,0982121     +0,0000128          IRP_MJ_READ   UP                        0x00000000         00 


    For me, the behavior is strange. 

    Is it normal, that the command is sent to the device so often? Is there an explanation for the behavior?

    Many thanks for your help,

    Werner


    • Edited by Werner89 Thursday, January 9, 2020 11:37 AM
    Thursday, January 9, 2020 11:27 AM

All replies

  • IOCTL_SERIAL_SET_TIMEOUTS passes a structure containing the timeout values, the first member is the timeout in milliseconds, and the rest of the members are constants and multipliers. According to your trace, it looks like the read timeout is FFFFFFFF, and the read multiplier is varying but seems to be within a reasonable range - as long as the hardware responds consistently. The problem with serial over USB is that it is sent as bulk traffic, which is the lowest priority on the USB. Is there anything else happening on the USB, such as audio or video (which use isochronous, the highest priority), when you are having problems?

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Friday, January 10, 2020 8:54 PM
    Moderator