iamは、システムに接続されている入力デバイスと出力デバイスを知りたいだけです。Javaを使用して入力/出力デバイスに関する情報を取得するためのAPIはありますか?
編集
オペレーティングシステムに依存しません。
提案してください。
システムに接続されている USB デバイスを見つけるには、jUSBを使用できます。この記事には、API の使用方法に関する詳細情報が含まれています。特に、すべての USB デバイスを検索するには (記事から少し変更):
Host host = HostFactory.getHost();
// Obtain a list of the USB buses available on the Host.
Bus[] bus = host.getBusses();
// Traverse through all the USB buses.
for (int i = 0; i < bus.length; i++) {
// Access the root hub on the USB bus and obtain the number of USB ports available on the root hub.
Device root = bus[i].getRootHub();
int totalPorts = root.getNumPorts();
// Traverse through all the USB ports available on the
// root hub. It should be mentioned that the numbering
// starts from 1, not 0.
for (int j=1; j<=total_port; j++) {
// Obtain the Device connected to the port.
Device device = root.getChild(j);
if (device != null) {
// USB device available, do something here.
}
}
}
同様に、MIDI システムの API を使用して、接続されている MIDI デバイスを見つけることができます。詳細については、Java チュートリアルを参照してください。
Java経由でコマンドラインを試す必要があると思いますRuntime.getRuntime().exec(command);
このサイトによるとhttp://michaelminn.com/linux/command_line 次のコマンドはこれを返すはずです:
lspci: Lists information about devices connected to the internal PCI busses.
lspci -vv: Full dump of information.
それで
String command="lspci";
また、Windows から DevCon コマンドをダウンロードする必要がある場合があります。http://support.microsoft.com/kb/311272/EN-US
それで
String command="devcon find";