Unable to access USB device in Windows Store app

OK, first I’ll point out that I’m completely new to Windows Apps Development, and that’s good, because I’m trying to develop a Windows Store app for my PC to use the PrimeSense scanner connected via USB. I asked a more specific question about this here .

This time I have a more general question, which is more related to the development of Windows Store applications. I am using VS2013 Express and compiling for Win32.

When I compile my application for VS2012 and run it as a file with the ability to change, I can connect perfectly to the scanner. But I can not do the same with VS2013 and run it as a Store application.

I know that the device is connected and the drivers are updated and all dll files are placed in the Widnows System 32 directory. I also added all the features in App Manifest and also added the following device features

<m2:DeviceCapability Name="usb"> <!--OSRFX2 Device--> <m2:Device Id="vidpid:1d27 0609"> <m2:Function Type="classId:ff * *" /> <m2:Function Type="name:vendorSpecific" /> </m2:Device> </m2:DeviceCapability> 

vid and pid obviously correspond to the corresponding device codes.

One of the errors that I get when trying to connect to the scanner using OpenNI is:

 Could not open to "\\?\usb#vid_1d27&pid_0609&mi_00#7&1601586a&0&0000#{c3b5f022-5a42-1980-1909-ea72095601b1}" USB Device not found 

This error is rather disappointing, since I know that the device is connected. Therefore, I am inclined to think that on the side of the Windows Store application there is a certain degree of complexity that does not allow connecting to the device. As I said, I am compiling for Win32.

Are there any chances that the drivers will not work in the Windows Store application. Are there any additional things that I have to do in the logic of the Windows Store application that I do not do, and what is needed to connect a USB device? Sorry, but I am completely new to developing applications for the Windows Store.

Thanks.

+6
source share
1 answer

You cannot do this from subway applications.

Usually you create a handle to this USB device, calling CreateFile with this path to the manManager object as the file to create. CreateFile is not allowed in metro applications - "only for desktop applications" - and its "replacement", CreateFile2, does not specifically allow you to open object manager objects.

In addition, the documentation for CreateFile2 indicates that in subway applications, this function can only open files and directories (and not such as pipes, mailboxes, consoles, etc.).

See also this post in social.msdn

If I missed something, I don’t think it is possible.

+1
source

Source: https://habr.com/ru/post/971235/


All Articles