none
I can't get a SerialDevice from modem

    Question

  •  i have COM3 COM4 COM5 

    and I have COM6 from USB Modem device

    but I can't open and use COM6 

    and my code :

    SerialDevice m_serialDevice = null; var myDevices = await DeviceInformation.FindAllAsync("System.Devices.InterfaceClassGuid:=\"{86E0D1E0-8089-11D0-9CE4-08003E301F73}"); //86E0D1E0-8089-11D0-9CE4-08003E301F73 is my SerialDevice GUID

    try { m_erialDevice = await SerialDevice.FromIdAsync(myDevices[0].Id); } catch (Exception exception) { Debug.WriteLine(exception.Message.ToString()); } finally { Debug.WriteLine("Opened device for communication."); }

    use this code I can find  COM3 COM4 COM5 and Success open for use 

    my usb modem guid is 2c7089aa-2e0e-11d1-b114-00c04fc2aae4

    i want to open the COM6 form modem device Use the following code but it's false  m_serialDevice and m_usbdevice all null

    //UsbDevice m_usbdevice = null; SerialDevice m_serialDevice = null; var myDevices = await DeviceInformation.FindAllAsync("System.Devices.InterfaceClassGuid:=\"{2c7089aa-2e0e-11d1-b114-00c04fc2aae4}"); //2c7089aa-2e0e-11d1-b114-00c04fc2aae4 is my modem device guid try// I can get Value myDevices[0].Id="\\?\USB#VID_2C7C&PID_0125&MI_03#6&8341f18&2&0003#{2c7089aa-2e0e-11d1-b114-00c04fc2aae4}" { m_serialDevice = await SerialDevice.FromIdAsync(myDevices[0].Id);//m_serialDevice is null // m_usbdevice = await UsbDevice.FromIdAsync(myDevices[0].Id);//m_usbdevice is null too } catch (Exception exception) { Debug.WriteLine(exception.Message.ToString()); } finally { Debug.WriteLine("Opened device for communication."); }


    I can get Value myDevices[0].Id="\\?\USB#VID_2C7C&PID_0125&MI_03#6&8341f18&2&0003#{2c7089aa-2e0e-11d1-b114-00c04fc2aae4}"

    but i can't get deviceobject use SerialDevice.FromIdAsync(myDevices[0].Id) and UsbDevice.FromIdAsync(myDevices[0].Id)


    how can i get the m_serialDevice object is not null



    • Edited by adil.liu Wednesday, March 6, 2019 10:49 AM Modify some grammatical errors
    Wednesday, March 6, 2019 8:29 AM

All replies

  • Hi,

    I have some questions here. What's the OS version of your device or the target version of your project Does the device appears in DeviceInformation.FindAllAsync() method?

    If you are not using the USB Modem device, just contact the COM6 device to your device directly, could you get the device correctly. 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by adil.liu Monday, March 11, 2019 2:08 AM
    • Unmarked as answer by adil.liu Monday, March 11, 2019 2:08 AM
    Thursday, March 7, 2019 8:06 AM
    Moderator
  • I can't post pictures. I'm limited. 

    I describe the serial port location in my device manager

    port(COM and LPT

    ---COM3

    ---COM4

    ---COM5

    modem device

    ---USB modem device (this is my com6)(I can't find and use this com6 with SerialDevice class) why?

    I know Serial Corresponding SerialDevice Class 

    usb Corresponding   UsbDevice Class

    but I can’t find com6 with SerialDevice Class

    I want to know witch class Corresponding the MODEM device



    • Edited by adil.liu Monday, March 11, 2019 7:10 AM Add description
    Monday, March 11, 2019 2:07 AM
  • Hi,

    I have some questions here. What's the OS version of your device or the target version of your project Does the device appears in DeviceInformation.FindAllAsync() method?

    If you are not using the USB Modem device, just contact the COM6 device to your device directly, could you get the device correctly. 

    Best regards,

    Roy


    my  OS version win10 1809(17763)  it is no problem use com3 4 5  

    the device appears in DeviceInformation.FindAllAsync() method i can find three devices COM 3 4 5  use code :var myDevices = await DeviceInformation.FindAllAsync("System.Devices.InterfaceClassGuid:=\"{86E0D1E0-8089-11D0-9CE4-08003E301F73}");

    then i can use code :m_erialDevice= await SerialDevice.FromIdAsync(myDevices[0].Id);

    //myDevices[1].Id,myDevices[2].Id, and get m_erialDevice object success and don't return null

    and I can find one device com6 use code:var myDevices =await DeviceInformation.FindAllAsync("System.Devices.InterfaceClassGuid:=\"{2c7089aa-2e0e-11d1-b114-00c04fc2aae4}");

    but I can't get the m_erialDevice object use the code :await SerialDevice.FromIdAsync(myDevices[0].Id); it is return NULL

    The problem is that this MODEM device can neither be used as a serial device object nor as a USB device object.



    • Edited by adil.liu Monday, March 11, 2019 2:59 AM Typesetting
    Monday, March 11, 2019 2:53 AM
  • Hi,

    So if you are not using the USB Modem device, just contact the COM6 device to your device directly, could you get the device correctly?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 12, 2019 7:53 AM
    Moderator
  • Hi,

    So if you are not using the USB Modem device, just contact the COM6 device to your device directly, could you get the device correctly?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    How foolish it is that!

    our project must use this serial port from the modem.

    You mean you can't get MODEM device from UWP?
    why UWP does not support MODEM devices?

    I Can use this COM6 with win32 project why UWP can’t find 

    You should deal with this bug.


    • Edited by adil.liu Tuesday, March 12, 2019 8:30 AM add
    Tuesday, March 12, 2019 8:25 AM
  • Hi,

    Well, it still needs investigate so that it could be confirmed whether it is a issue with UWP or other things. I had asked the team about this.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 15, 2019 2:32 AM
    Moderator