openUSB
获取USB设备信息
openUSB(callback(ret, err))
callback(ret)
ret:
- 类型:JSON对象
- 内部字段:status 布尔型
- 内部字段:deviceinfo JSON对象
{
"deviceInfo": {
"0": {
"0": "Bus=0001 Vendor=80ee Product=cafe Version=0500 ",
"1": "Name=\"VirtualBox mouse integration\" ",
"2": "Phys= ",
"3": "Sysfs=/devices/pci0000:00/0000:00:04.0/input/input3 ",
"4": "Uniq= ",
"5": "Handlers=event3 ",
"6": "PROP=0 ",
"7": "EV=b ",
"8": "KEY=10000 0 0 0 0 0 0 0 0 ",
"9": "ABS=3 ",
"10": " "
},
"1": {
"0": "Bus=0000 Vendor=dbdb Product=0002 Version=0001 ",
"1": "Name=\"gpio\" ",
"2": "Phys= ",
"3": "Sysfs=/devices/virtual/input/input6 ",
"4": "Uniq= ",
"5": "Handlers=kbd event6 ",
"6": "PROP=0 ",
"7": "EV=23 ",
"8": "KEY=c0000 0 0 0 ",
"9": "SW=1 ",
"10": " "
}
}
}
示例代码
var demo = api.require('sunmiT1Printer');
demo.openUSB(function(ret, err) {
alert(JSON.stringify(ret));
});
可用性
Android系统
可提供的1.0.0及更高版本