none
请教一下HID设备,怎么在metro app和desktop app下同步? RRS feed

  • 问题

  • 我在desktop app和metro app 都有程序会访问同一个HID设备,在metro app使用HID设备时,有时候,desktop也周期性的给HID设备发消息,导致metro app得到的消息异常。请问怎么能让StreamSocketListenerdesktop app和metro app访问同一个设备的时候同步、类似的锁的也可以?
    2014年6月30日 3:41

全部回复

  • 你好,

    不是很明白你的意思,你是说想在Store App占用HID设备的时候,Desktop应用来接管HID么?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年7月1日 2:25
    版主
  • 你好,

    不是很明白你的意思,你是说想在Store App占用HID设备的时候,Desktop应用来接管HID么?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    在Store App给HID发消息,并等待HID设备回消息的时候,Desktop App也会给HID设备发消息。

    2014年7月1日 8:44
  • 你好,

    Windows Store App中队HID信息的处理已经有类似让步的举措,参考一下文档: Human Interface Devices (HID)

    里面提到为了避免和Windows API或者OS冲突,Windows Store App已经屏蔽了顶层usage page的使用,所以你Desktop Application使用的UsagePage是否包含在内?

    The Windows.Devices.HumanInterfaceDevice API supports most HID devices. However, it blocks the top-level application collection represented by the following usage pages, to prevent conflict with other Windows APIs and OS behavior:

    • HID_USAGE_PAGE_UNDEFINED
    • HID_USAGE_PAGE_GENERIC
    • HID_USAGE_GENERIC_KEYBOARD
    • HID_USAGE_GENERIC_KEYPAD
    • HID_USAGE_GENERIC_SYSTEM_CTL
    • HID_USAGE_PAGE_KEYBOARD
    • HID_USAGE_PAGE_CONSUMER
    • HID_USAGE_PAGE_DIGITIZER
    • HID_USAGE_PAGE_SENSOR
    • HID_USAGE_PAGE_BARCODE_SCANNER
    • HID_USAGE_PAGE_WEIGHING_DEVICE
    • HID_USAGE_PAGE_MAGNETIC_STRIPE_READER
    • HID_USAGE_PAGE_TELEPHONY

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年7月3日 3:12
    版主
  •  这个usagepage是我们自定义的,不在上面的列表里面。还有其他的办法吗?
    2014年7月3日 8:36
  • 你好,这个我帮你去问一下吧,我也不是很清楚,不过我认为可能没办法,毕竟是系统封装的功能。

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年7月4日 8:49
    版主
  • 我在desktop app和metro app 都有程序会访问同一个HID设备,在metro app使用HID设备时,有时候,desktop也周期性的给HID设备发消息,导致metro app得到的消息异常。请问怎么能让StreamSocketListenerdesktop app和metro app访问同一个设备的时候同步、类似的锁的也可以?

    2014年7月5日 2:34
  • 你好,

    我这里问到了点东西,看看对你是否有帮助。

    首先Windows Store App里面的 API: Windows.Devices.HumanInterfaceDevice 仅仅支持不在列表中的UsagePage,这里你的应该是不在列表中。

    其次,这些设备必须不能是PC自带的,需要是额外的那种设备才行。

    同时,你可以测试一下,先从Windows Store App中运行不同的UsagePage然后再开启Desktop程序对它的访问么?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年7月15日 9:43
    版主