Reputation: 1
I'm making an app in UWP for Raspberry Pi 3B with this touch screen https://www.waveshare.com/wiki/5inch_HDMI_LCD_(B)
The touch panel on the screen is not lined up properly, so there is a need to calibrate it. But in order to do that I need access to raw coordinate data from it. I have tried using a Tapped event, but the OS registers those coordinates (the bad ones) from the touch screen and processes them, so basically the wrong button gets tapped.
I tried to connect to the touch screen from Windows.Devices.HumanInterfaceDevice.HidDevice:
private HidDevice _device;
public HidDevice device
{
get
{
return _device;
}
set
{
_device = value;
}
}
public MainPage()
{
this.InitializeComponent();
EnumerateDevices(usgPage, vend, prodId);
}
public async Task EnumerateDevices(ushort usgPage, ushort vend, ushort prodId, ushort usgId)
{
ushort usagePage = usgPage;
ushort vendor = vend;
ushort productId = prodId;
ushort usageId = usgId;
var selector = HidDevice.GetDeviceSelector(usagePage, usageId, vendor, productId);
DeviceInformationCollection devices;
devices = await DeviceInformation.FindAllAsync(selector);
var a = devices[0].Id;
try
{
devices = await DeviceInformation.FindAllAsync(selector);
}
catch
{
return;
}
device = await HidDevice.FromIdAsync(a, Windows.Storage.FileAccessMode.ReadWrite);
}
Manifest
<Capabilities>
<DeviceCapability Name="humaninterfacedevice">
<Device Id="vidpid:0EEF 0005">
<Function Type="usage:000D 0004" />
</Device>
</Capabilities>
But the device is always null, even though devices containes my touch screen. I think it is because the OS communicates with the touch screen, and as a result, I cannot interact with it.
I tried to disable PnP with
Get-PnpDevice | Where-Object {$_.FriendlyName -like '*touch screen*'} | Disable-PnpDevice -Confirm:$false
from powershell, which disabled the touch screen completely and I could not see it even in devices list.
So I tried to change registry with
reg add HKLM\Software\Microsoft\Wisp\Touch -v TouchGate -f -d 0 -t REG_DWORD
but the OS still interacted with the touch screen and it had no effect at all. Also, I checked whether the value in the registry has indeed changed and it has.
My idea is that if it would be possible somehow to tell the OS to ignore the input from the touchscreen but not disabling the HID device completely so I could connect to it from my UWP app and handle the coordinates myself (like calculating the correct position for pointer) and then I would inject with Windows.UI.Input.Preview.Injection.InputInjector a point with correct coordinates.
Upvotes: 0
Views: 343