本文整理汇总了Java中org.usb4java.LibUsb.ERROR_NOT_SUPPORTED属性的典型用法代码示例。如果您正苦于以下问题:Java LibUsb.ERROR_NOT_SUPPORTED属性的具体用法?Java LibUsb.ERROR_NOT_SUPPORTED怎么用?Java LibUsb.ERROR_NOT_SUPPORTED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.usb4java.LibUsb
的用法示例。
在下文中一共展示了LibUsb.ERROR_NOT_SUPPORTED属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildCompatibleDevicesList
private List<Device> buildCompatibleDevicesList() {
final List<Device> compatibleDevicesListLocal = new ArrayList<>();
final DeviceList devList = new DeviceList();
LibUsb.getDeviceList(null, devList);
final DeviceDescriptor devDesc = new DeviceDescriptor();
for (final Device dev : devList) {
LibUsb.getDeviceDescriptor(dev, devDesc);
final ImmutablePair<Short, Short> vidPid = new ImmutablePair<>(devDesc.idVendor(), devDesc.idProduct());
// Check that the device is not already bound to any other driver.
final DeviceHandle devHandle = new DeviceHandle();
int status = LibUsb.open(dev, devHandle);
if (status != LibUsb.SUCCESS) {
continue; // Skip device.
}
status = LibUsb.kernelDriverActive(devHandle, 0);
LibUsb.close(devHandle);
if (((status == LibUsb.ERROR_NOT_SUPPORTED) || (status == LibUsb.SUCCESS))
&& vidPidToClassMap.containsKey(vidPid)) {
// This is a VID/PID combination we support, so let's add the
// device to the compatible
// devices list and increase its reference count.
compatibleDevicesListLocal.add(LibUsb.refDevice(dev));
}
}
LibUsb.freeDeviceList(devList, true);
return compatibleDevicesListLocal;
}
示例2: buildCompatibleDevicesList
private List<Device> buildCompatibleDevicesList() {
final List<Device> compatibleDevicesListLocal = new ArrayList<>();
final DeviceList devList = new DeviceList();
LibUsb.getDeviceList(null, devList);
final DeviceDescriptor devDesc = new DeviceDescriptor();
for (final Device dev : devList) {
LibUsb.getDeviceDescriptor(dev, devDesc);
final ImmutablePair<Short, Short> vidPid = new ImmutablePair<>(devDesc.idVendor(), devDesc.idProduct());
// Check that the device is not already bound to any other driver.
final DeviceHandle devHandle = new DeviceHandle();
int status = LibUsb.open(dev, devHandle);
if (status != LibUsb.SUCCESS) {
continue; // Skip device.
}
status = LibUsb.kernelDriverActive(devHandle, 0);
LibUsb.close(devHandle);
if (((status == LibUsb.ERROR_NOT_SUPPORTED) || (status == LibUsb.SUCCESS)) && vidPidToClassMap.containsKey(vidPid)) {
// This is a VID/PID combination we support, so let's add the
// device to the compatible
// devices list and increase its reference count.
compatibleDevicesListLocal.add(LibUsb.refDevice(dev));
}
}
LibUsb.freeDeviceList(devList, true);
return compatibleDevicesListLocal;
}
示例3: setSamplingMode
public void setSamplingMode(SampleMode mode) throws LibUsbException
{
switch(mode)
{
case QUADRATURE:
/* Set intermediate frequency to 0 Hz */
setIFFrequency(0);
/* Enable I/Q ADC Input */
writeDemodRegister(mDeviceHandle,
Page.ZERO,
(short) 0x08,
(short) 0xCD,
1);
/* Enable zero-IF mode */
writeDemodRegister(mDeviceHandle,
Page.ONE,
(short) 0xB1,
(short) 0x1B,
1);
/* Set default i/q path */
writeDemodRegister(mDeviceHandle,
Page.ZERO,
(short) 0x06,
(short) 0x80,
1);
break;
case DIRECT:
default:
throw new LibUsbException("QUADRATURE mode is the only mode "
+ "currently supported", LibUsb.ERROR_NOT_SUPPORTED);
}
}
示例4: setSamplingMode
public void setSamplingMode( SampleMode mode ) throws LibUsbException
{
switch( mode )
{
case QUADRATURE:
/* Set intermediate frequency to 0 Hz */
setIFFrequency( 0 );
/* Enable I/Q ADC Input */
writeDemodRegister( mDeviceHandle,
Page.ZERO,
(short)0x08,
(short)0xCD,
1 );
/* Enable zero-IF mode */
writeDemodRegister( mDeviceHandle,
Page.ONE,
(short)0xB1,
(short)0x1B,
1 );
/* Set default i/q path */
writeDemodRegister( mDeviceHandle,
Page.ZERO,
(short)0x06,
(short)0x80,
1 );
break;
case DIRECT:
default:
throw new LibUsbException( "QUADRATURE mode is the only mode "
+ "currently supported", LibUsb.ERROR_NOT_SUPPORTED );
}
}