UWP access to COM3 (Serial Port) on Panasonic Tablet (FZ-F1) -

Christopher Zielinski 21 Reputation points
2020-02-05T15:45:47.13+00:00

SerialDevice.FromIdAsync( ) is always returning null due to "Access to the device was blocked by the system : \?\USB#VID_1546&PIC_01A8#5&46E708A&0&10#{86e0d1e0-8089-11d0-9ce4-08003e301f73}"

I did request access to the device in the UWP application manifest...

2516-untitled.png

But, _device is always getting assigned null, in the following code...

public async Task AttachedToGps()  
{  
    const uint baudRate = 9600;  
    const ushort dataBits = 8;  
    const SerialParity parity = SerialParity.None;  
  
    ushort vid = 0x1546;  
    ushort pid = 0x01A8;  
    var selector = SerialDevice.GetDeviceSelectorFromUsbVidPid(vid, pid);  
  
    var devices = await DeviceInformation.FindAllAsync(selector);  
  
    if (devices.Any())  
    {  
        var deviceInfo = devices.First();  
  
        _device = await SerialDevice.FromIdAsync(deviceInfo.Id);  
  
        _device.BaudRate = baudRate;  
        _device.DataBits = dataBits;  
        _device.Parity = parity;  
  
        _device.ReadTimeout = TimeSpan.FromMilliseconds(500);  
        _device.WriteTimeout = TimeSpan.FromMilliseconds(500);  
  
        _deviceChannel = new NmeaParser.SerialPortDevice(_device);  
    }  
    return _deviceChannel;  
}  
  

What more do I need to do, to get access to this serial communications device? This source code did work on an older version of the device (and Windows 10 Pro O/S).

Many thanks to anyone that can help!

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Roy Li - MSFT 33,926 Reputation points Microsoft Vendor
    2020-03-02T09:45:20.347+00:00

    Hello,

    Welcome to Microsoft Q&A!

    It seems that Windows.Devices.SerialCommunication.SerialDevice class can't get SerialDevice instance of a virtual COM port. It will return null like the result you got.
    You could try to use System.IO.Ports.SerialPort class instead.
    Please refer to this Blog: How to access virtual COM port from UWP app for more information.

    Thank you.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.