답변됨 metro app and scanner device

  • 8. dubna 2012 23:16
     
     

    I would like to make my Metro App communicate with my scanner device.

    In case of Desktop App, it could communicate with the scanner by;
    1. My INF file installed usbscan.sys and my STI minidriver.
    2. The app created STI instance and communicated with the scanner by STI.

    My questions about Metro App are;
    1. Is it possible for Metro App to communicate with the scanner by STI?
    (I guess the answer is 'NO')
    2. Is it possible for Metro App to communicate with the scanner by usbscan.sys?
    (I hope the answer is 'YES', but I'm afraid it is 'NO' because I guess usbscan.sys is for only Desktop App)
    3. Must I make a driver like usbscan.sys in order to make my Metro App communicate with the scanner?
    (I guess the answer is 'YES')

    Thanks

Všechny reakce

  • 9. dubna 2012 17:09
    Moderátor
     
     

    Nmaso,

    I will look into this for you.

    Best Wishes - Eric

  • 9. dubna 2012 23:45
     
      Obsahuje kód

    Thanks, Eric.

    Please let me explain my current status.

    I thought a scanner device was one of custom devices, so

    1. Added the below section to INF file (I used x64 for test) and installed it by DpInst.
    [DDInstall.NTamd64]
    AddProperty=DDInstall_Interface_AddProperty

    [DDInstall.NTamd64.Interfaces]
    AddInterface={GUID},,DDInstall_Interface

    [DDInstall_Interface]
    AddProperty=DDInstall_Interface_AddProperty

    [DDInstall_Interface_AddProperty]
    ; DEVPKEY_DeviceInterface_Restricted
    {026e516e-b814-414b-83cd-856d6fef4822},6,0x11,,1

    * I'm not sure where AddProperty should be written, so I added it to two sections.

    2. Created the device metadata by Device Metadata Authoring Wizard and installed it to DeviceMetadataStore folder.
    PackageInfo.xml
    <HardwareID>DOID:USB\VID_(vid)&amp;PID_(pid)</HardwareID>

    SoftwareInfo.xml
    <DeviceCompanionApplications>
    <PrivilegedApplications>

    3. Added the below element to Package.appxmanifest.
    <Capabilities>
     <DeviceCapability Name="GUID specified at INF" />
    </Capabilities>

    4. Then tried to access the device by the below code.

    ICreateDeviceAccessAsync *createasync = nullptr;
    // {6bdd1fc6-810f-11d0-bec7-08002be2092f} is GUID of STI interface.
    CreateDeviceAccessInstance("\\\\?\\USB#VID_(vid)&PID_(pid)#foobar#{6bdd1fc6-810f-11d0-bec7-08002be2092f}", GENERIC_READ | GENERIC_WRITE, &createasync);
    
    createasync->Wait(10000);
    
    IDeviceIoControl *control = nullptr;
    createasync->GetResult(IID_IDeviceIoControl, (void**)&control);

    I intended to access the scanner by usbscan.sys. However GetResult method returned E_ACCESSDENIED.

    I'm not sure if my INF/metadata/manifest has any problem or I have to make a device driver.
    So I asked yesterday's question here.

    Thank you.


    • Upravený nmasao 10. dubna 2012 6:10
    •  
  • 11. dubna 2012 2:07
     
     Odpovědět

    Eric, GetResult method worked well when I edited INF file!

    [DDInstall.NTamd64.Interfaces]
    AddInterface={GUID},,DDInstall_Interface

    I changed the above GUID from my custom value to STI value, that is, {6bdd1fc6-810f-11d0-bec7-08002be2092f}. Also, I edited Package.appxmanifest. Then GetResult method returned S_OK.

    I will try IDeviceIoControl from now. I greatly appreciate your support.

    Thanks

  • 11. dubna 2012 5:52
     
     

    Eric,

    Now my App can communicate with usbscan.sys via IDeviceIoControl.

    By the way, the specification of usbscan.sys is "The control and interrupt endpoints are accessible using I/O control codes and DeviceIoControl. The bulk endpoints are accessible using ReadFile and WriteFile". http://msdn.microsoft.com/en-us/library/windows/hardware/ff548563(v=vs.85).aspx)

    However, IDeviceIoControl has only DeviceIoControlAsync/Sync method. So I must still make a kernel driver in order to access the bulk endpoints.

    - Is my understanding right?
    - Is there any plan to make usbscan.sys access the bulk endpoints by DeviceIoControl? (maybe using new IOCTL) If yes, all the scanner vendors don't have to make a kernel driver by themselves.


    • Upravený nmasao 11. dubna 2012 5:53
    •  
  • 13. dubna 2012 5:31
    Moderátor
     
     

    nmasao,

    Scanning is not a supported Metro scenario in Windows 8.  However, scanning continues to be available on the desktop as it was in Windows 7.

    Best Wishes - Eric

  • 16. dubna 2012 8:42
     
     

    Thanks, Eric.

    Do you mean STI/WIA/scsiscan.sys/usbscan.sys are not supported by Metro? (therefore, a scanner vendor may make a KMDF/UMDF scanner driver by themselves)

    Or do you mean Microsoft's policy prohibits a scanner vendor from making a scanner driver? (in this case, can you tell me the reason? for example, scanning apps don't go well with Metro style, etc.)

  • 10. října 2012 8:09
     
     

    Hi, I am interested in porting a Windows desktop application, that uses WIA for communicating with a scanner, to a Windows Store App . You are saying that I can't use WIA from a Windows Store App, am I correct? Is scanning still not supported scenario in Metro (or wathever is its final name)?