Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: FT232H with UWP? #2349

Closed
myokeeh opened this issue Aug 26, 2024 · 11 comments
Closed

Question: FT232H with UWP? #2349

myokeeh opened this issue Aug 26, 2024 · 11 comments
Assignees

Comments

@myokeeh
Copy link

myokeeh commented Aug 26, 2024

I have an app that for several reasons associated with Microsoft decisions, I cannot fully release as a WinUI3 / WindowsAppSDK app.

Is there a way to allow a UWP app to work with what's documented here: https://github.com/dotnet/iot/tree/main/src/devices/Ft232H?

I've tried the sample code, and it works on a WinUI3 test app, but something's not allowing the UWP test app to properly connect to the FT232H. It sees a device, but that's about as far as it gets.

@pgrawehr
Copy link
Contributor

Can you explain your problem a bit clearer? You write "I've tried the sample code, and it works on a WinUI3 test app" and also " something's not allowing the UWP test app to properly connect to the FT232H". That is contradictory. Can you show what code you used and what did and what did not work?

@myokeeh
Copy link
Author

myokeeh commented Aug 26, 2024


var devices = FtCommon.GetDevices();
Console.WriteLine($"{devices.Count} available device(s)");
foreach (var device in devices)
{
    Console.WriteLine($"  {device.Description}");
    Console.WriteLine($"    Flags: {device.Flags}");
    Console.WriteLine($"    Id: {device.Id}");
    Console.WriteLine($"    LocId: {device.LocId}");
    Console.WriteLine($"    Serial number: {device.SerialNumber}");
    Console.WriteLine($"    Type: {device.Type}");
}

if (devices.Count == 0)
{
    Console.WriteLine("No device connected");
    return;
}

The above code works fine for a WinUI3 / WindowsAppSDK app. It does not work for a UWP app.

Specifically, the device type reported is "UnknownDevice" with the UWP app vs. "FT232H" with the WinUI3 / WindowsAppSDK.

@Ellerbach
Copy link
Member

As far as I remember, UWP requires to declare that you require to access specific hardware. For this, you need to follow the documentation: https://learn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations
You may even need to specific USB vendor ID and product ID.

@myokeeh
Copy link
Author

myokeeh commented Aug 27, 2024

  <Capabilities>
    <Capability Name="internetClient" />
    <iot:Capability Name="lowLevelDevices"/>
    <DeviceCapability Name="lowLevel"/>
  </Capabilities>

I already had the above capabilities defined (prior to posting here). I also tried runFullTrust but didn't make a difference.

First, is there a way to be more definite if this is supposed to work on UWP? Second, if it is, what specific things do I need? I feel there's too many variables.

@Ellerbach
Copy link
Member

@myokeeh you may want to have a look at the series of article here: https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/writing-usb-device-companion-apps-for-microsoft-store there is maybe something more to setup for UWP. It's specific to USB devices, it seems that you need to specify more than you do, see: https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/talking-to-usb-devices-start-to-finish#add-usb-device-capabilities-to-the-app-manifest

@joperezr joperezr added Needs: Author Feedback We are waiting for author to react to feedback (action required) and removed untriaged labels Sep 12, 2024
@myokeeh
Copy link
Author

myokeeh commented Sep 16, 2024

I'm hopeful maybe this latest news helps in making this all work together.

https://devblogs.microsoft.com/ifdef-windows/preview-uwp-support-for-dotnet-9-native-aot/

@dotnet-policy-service dotnet-policy-service bot removed Needs: Author Feedback We are waiting for author to react to feedback (action required) Status: No Recent Activity labels Sep 16, 2024
@myokeeh
Copy link
Author

myokeeh commented Sep 18, 2024

I've tried the following and still can't get it to work:

		<DeviceCapability Name="usb">
			<Device Id="vidpid:0403 6014">
				<Function Type="classId:ff * *"/>
				<Function Type="name:vendorSpecific"/>
			</Device>
		</DeviceCapability>

@krwq
Copy link
Member

krwq commented Oct 10, 2024

[Triage] @myokeeh At the moment, we don't have any immediate plans to look into better support for UWP as our current focus is on other priorities. We believe the issue is about the permissions and you'll need to explore this further to get this to work. Sorry we couldn't be of any more help and we'll close it since it's not actionable for us. If you have any findings please share it with us so that we can point other people with similar problems. Feel free to re-open if you have any more findings.

@krwq krwq closed this as completed Oct 10, 2024
@Ellerbach
Copy link
Member

Ellerbach commented Oct 10, 2024

@myokeeh one last thing to try, can you try this:

    <DeviceCapability Name="usb">
      <Device Id="vidpid:0403&amp;6014">
        <Function Type="classId:ff * *"/>
        <Function Type="name:vendorSpecific" />
      </Device>
    </DeviceCapability>

The difference is in the device ID, it seems that the & is needed and was missing in your definition

@myokeeh
Copy link
Author

myokeeh commented Oct 11, 2024

@Ellerbach, does not work with the ampersand.

Validation error. error C00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 44, Column 15, Reason: 'vidpid:0403&6014' violates pattern constraint of 'any|vidpid:[0-9a-fA-F]{4} [0-9a-fA-F]{4}( (usb|bluetooth))?|model:[^;]{1,512};.{1,512}'. The attribute 'Id' with value 'vidpid:0403&6014' failed to parse.	FT232H Test	C:\source\repos\FT232H Test\FT232H Test\bin\x64\Debug\AppxManifest.xml		

@Ellerbach
Copy link
Member

@myokeeh then I really don't have any other idea!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants