当前位置: 首页>>代码示例>>Java>>正文


Java LibUsb.ERROR_NOT_SUPPORTED属性代码示例

本文整理汇总了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;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:39,代码来源:LibUsbHardwareInterfaceFactory.java

示例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;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:36,代码来源:LibUsb3HardwareInterfaceFactory.java

示例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);
    }
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:35,代码来源:RTL2832TunerController.java

示例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 );
	}
}
 
开发者ID:ac2cz,项目名称:FoxTelem,代码行数:35,代码来源:RTL2832TunerController.java


注:本文中的org.usb4java.LibUsb.ERROR_NOT_SUPPORTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。