none
Read Write to Comm port greater than 9 fails RRS feed

  • Question

  • Hi all,

    I have more than 10 serial comm ports and i have given indexing to each of it as greater than 9 starting from 10 onwards by modifying the platform.reg file for index no of each.

    Ports 0-9 are kept for Bluetooth.

    I can successfully open the ports using this :-

    hSerial = CreateFile(L"/$device/COM15" ,

    GENERIC_READ | GENERIC_WRITE,

    0,

    NULL,

    OPEN_EXISTING,

    FILE_ATTRIBUTE_NORMAL,

    NULL);

    Each port from 10 - 19 opens but when i try to write/read it returns 0 byte.

    The same works if i map it from 0-9 in platform.reg and opens using normal method.

     

    I am not sure where am i doing mistake.

    could any of you share your experience in this regard.

     

    Thanks

    Misbah

    Tuesday, September 21, 2010 3:21 PM

All replies

  • Shouldn't it be backslash?

    hSerial = CreateFile(L"\\$device\\COM15" ,...

    Tuesday, September 21, 2010 4:20 PM
  • It could be but a single front slash also works. May be i will try it also.

     

    I am able to open the device and getting a valid handle, but read write is not happening.

    After time out it is returning with 0 bytes read/write.

    regards,

    Misbah

     

    Wednesday, September 22, 2010 5:17 AM
  • Do you open all of the drivers in the exact same way?  That is do you open COM1 with hSerial = CreateFile(L"/$device/COM1" ?

    Have you done any debugging of your driver?  Have you checked and double checked your registry settings to verify that you have them all set up correctly?


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Wednesday, September 22, 2010 4:19 PM
    Moderator
  • Hi Bruce,

    Yes I am opening all the device in the exact same way. My serial devices are COM11 to COM19 

    In the registry i have set the index for com11 to com19. I am able to get a valid handle for CreateFile(L"/$device/COM11" to COM19 but for ReadFile() and WriteFile() it gets blocked and returns 0 byte after timeout.

     

    I am debugging the driver but just want to make sure that this problem is not related to WinCE configuration, method of using CreatFile API, or any other settings (registry etc)

     

    Actually the driver works fine with opening the port with CreatFile(L"COM1:" and so on if index is between 1-9. The driver is using gissr.dll (shared interrupt).

     

    Thanks

    Misbah 

    Thursday, September 23, 2010 5:28 AM
  • My question was does it work if you use COM1 by opening it with /$device/COM1?
    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Thursday, September 23, 2010 12:40 PM
    Moderator