问题描述
我正在尝试检测计算机上是否存在无线鼠标.我希望我的程序在后台运行.我更喜欢用Java来做,但是如果这超出了Java的能力,我可以使用另一种语言.
I am trying to detect whether a wireless mouse is present on a computer. I would like my program to run in the background. I would prefer to do this in Java however if this goes beyond Java's capabilities I can use another language.
有人可以让我入门吗?
(这似乎是Google可以回答的问题,但我找不到任何东西)
(This seems like a Google-able question but I cannot find anything)
推荐答案
这是Java之外的,并且是特定于操作系统的.您必须查询操作系统的相应设备驱动程序;例如,在Linux上,这意味着要在evdev
系统中查找信息.请注意,无线的特定类型"非常重要,您可能无法以任何可靠的方式分辨出来.例如,蓝牙鼠标始终是无线的,但是某些无线设备与USB加密狗连接,因此可能无法与有线USB设备区分开.
This is beyond Java and is highly OS-specific. You have to query the appropriate device drivers for the operating system; for example, on Linux this would mean looking up information in the evdev
system. Note that the particular "type" of wireless will matter a lot, and you may not be able to tell in any reliable way. For example, a Bluetooth mouse is always wireless, but some wireless devices connect with a USB dongle and may not be distinguishable from a wired USB device.
这篇关于检测鼠标是否为无线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!