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


Java LibUsb.releaseInterface方法代码示例

本文整理汇总了Java中org.usb4java.LibUsb.releaseInterface方法的典型用法代码示例。如果您正苦于以下问题:Java LibUsb.releaseInterface方法的具体用法?Java LibUsb.releaseInterface怎么用?Java LibUsb.releaseInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.usb4java.LibUsb的用法示例。


在下文中一共展示了LibUsb.releaseInterface方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: detach

import org.usb4java.LibUsb; //导入方法依赖的package包/类
boolean detach() {
    if (m_isAttached == false) {
        return false;
    }
    int r;
    r = LibUsb.releaseInterface(dev_handle, 1);
    if (r != 0) {
        return false;
    }

    if (m_isKernellDetached == true) {
        LibUsb.attachKernelDriver(dev_handle, 1);
        m_isKernellDetached = false;
    }
    LibUsb.close(dev_handle);
    dev_handle = null;
    LibUsb.exit(ctx);
    ctx = null;
    m_isAttached = false;
    return true;
}
 
开发者ID:MohamadSaada,项目名称:LogiGSK,代码行数:22,代码来源:Keyboard.java

示例2: disconnect

import org.usb4java.LibUsb; //导入方法依赖的package包/类
/**
 * Disconnect from the USB device.
 */
public void disconnect ()
{
    if (this.handle == null)
        return;

    // Prevent further sending
    final DeviceHandle h = this.handle;
    this.handle = null;

    final int result = LibUsb.releaseInterface (h, INTERFACE_NUMBER);
    if (result != LibUsb.SUCCESS)
        throw new LibUsbException ("Unable to release interface", result);

    LibUsb.close (h);
    LibUsb.exit (null);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:USBDisplay.java

示例3: release

import org.usb4java.LibUsb; //导入方法依赖的package包/类
/**
 * Releases the USB interface
 */
public void release()
{
    try
    {
        if(mUSBTransferProcessor != null)
        {
            mUSBTransferProcessor.removeAllListeners();
            TunerManager.LIBUSB_TRANSFER_PROCESSOR.unregisterTransferProcessor(mUSBTransferProcessor);
        }

        LibUsb.releaseInterface(mDeviceHandle, USB_INTERFACE);
    }
    catch(Exception e)
    {
        mLog.error("attempt to release USB interface failed", e);
    }
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:21,代码来源:RTL2832TunerController.java

示例4: release

import org.usb4java.LibUsb; //导入方法依赖的package包/类
/**
   * Releases the USB interface
   */
  public void release()
  {
try
      {
	if( mBufferProcessor.isRunning() )
	{
		mBufferProcessor.stop();
	}
	
       LibUsb.releaseInterface( mDeviceHandle, USB_INTERFACE );
       
       LibUsb.exit( null );
      }
      catch ( Exception e )
      {
      	Log.errorDialog( "attempt to release USB interface failed", e.getMessage() );
      }
  }
 
开发者ID:ac2cz,项目名称:FoxTelem,代码行数:22,代码来源:RTL2832TunerController.java

示例5: closeUSB

import org.usb4java.LibUsb; //导入方法依赖的package包/类
private void closeUSB(){
  if(usb_device_handle != null){
    LibUsb.releaseInterface(usb_device_handle, 0);
    LibUsb.close(usb_device_handle);
    usb_device_handle = null;
  }

  if(usb_device != null){
    LibUsb.unrefDevice(usb_device);
    usb_device = null;
  }
}
 
开发者ID:diwi,项目名称:PS3Eye,代码行数:13,代码来源:PS3Eye.java

示例6: releaseDevice

import org.usb4java.LibUsb; //导入方法依赖的package包/类
/** release the device from exclusive use */
public void releaseDevice() throws HardwareInterfaceException {
	CypressFX2.log.log(Level.INFO, "{0} releasing device", this);

	final int status = LibUsb.releaseInterface(deviceHandle, 0);
	if (status != LibUsb.SUCCESS) {
		throw new HardwareInterfaceException("Unable to release device from exclusive use: "
			+ LibUsb.errorName(status));
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:11,代码来源:CypressFX2.java

示例7: close

import org.usb4java.LibUsb; //导入方法依赖的package包/类
/**
 * Closes the device. Never throws an exception.
 */
@Override
synchronized public void close() {
	if (!isOpen()) {
		return;
	}

	try {
		setEventAcquisitionEnabled(false);

		if (asyncStatusThread != null) {
			asyncStatusThread.stopThread();
		}
	}
	catch (final HardwareInterfaceException e) {
		e.printStackTrace();
	}

	LibUsb.releaseInterface(deviceHandle, 0);
	LibUsb.close(deviceHandle);

	deviceHandle = null;
	deviceDescriptor = null;

	inEndpointEnabled = false;
	isOpened = false;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:30,代码来源:CypressFX2.java

示例8: releaseDevice

import org.usb4java.LibUsb; //导入方法依赖的package包/类
/** release the device from exclusive use */
public void releaseDevice() throws HardwareInterfaceException {
	CypressFX3.log.log(Level.INFO, "{0} releasing device", this);

	final int status = LibUsb.releaseInterface(deviceHandle, 0);
	if (status != LibUsb.SUCCESS) {
		throw new HardwareInterfaceException("Unable to release device from exclusive use: " + LibUsb.errorName(status));
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:10,代码来源:CypressFX3.java

示例9: releaseDevice

import org.usb4java.LibUsb; //导入方法依赖的package包/类
/**
 * release the device from exclusive use
 */
public void releaseDevice() throws HardwareInterfaceException {
    SiLabsC8051F320_LibUsb.log.log(Level.INFO, "{0} releasing device", this);

    final int status = LibUsb.releaseInterface(retinahandle, 0);
    if (status != LibUsb.SUCCESS) {
        throw new HardwareInterfaceException("Unable to release device from exclusive use: "
                + LibUsb.errorName(status));
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:13,代码来源:SiLabsC8051F320_LibUsb.java

示例10: closeDevice

import org.usb4java.LibUsb; //导入方法依赖的package包/类
private void closeDevice() {
    System.out.println("Shutting down device.");

    // Use reset to close connection.
    if (devHandle != null) {
        LibUsb.releaseInterface(devHandle, 0);
        LibUsb.close(devHandle);
        devHandle = null;

        LibUsb.exit(null);
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:13,代码来源:ATCFpgaConfig.java

示例11: close

import org.usb4java.LibUsb; //导入方法依赖的package包/类
public synchronized void close() {
	// Execute cleanup tasks.
	for (final Runnable r : cleanupTasks) {
		r.run();
	}

	// Clear cleanup tasks list, will be readded as needed.
	cleanupTasks.clear();

	if (devHandle != null) {
		LibUsb.releaseInterface(devHandle, 0);
		LibUsb.close(devHandle);
		devHandle = null;
	}
}
 
开发者ID:inilabs,项目名称:flashy,代码行数:16,代码来源:UsbDevice.java

示例12: releaseInterface

import org.usb4java.LibUsb; //导入方法依赖的package包/类
public static void releaseInterface(DeviceHandle handle)
    throws SourceException
{
    int result = LibUsb.releaseInterface(handle, USB_INTERFACE);

    if(result != LibUsb.SUCCESS)
    {
        throw new SourceException("couldn't release interface [" +
            LibUsb.errorName(result) + "]");
    }
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:12,代码来源:RTL2832TunerController.java

示例13: releaseInterface

import org.usb4java.LibUsb; //导入方法依赖的package包/类
public static void releaseInterface( DeviceHandle handle ) 
					throws DeviceException
{
	int result = LibUsb.releaseInterface( handle, USB_INTERFACE );
	
	if( result != LibUsb.SUCCESS )
	{
		throw new DeviceException( "couldn't release interface [" + 
				LibUsb.errorName( result ) + "]" );
	}
}
 
开发者ID:ac2cz,项目名称:FoxTelem,代码行数:12,代码来源:RTL2832TunerController.java

示例14: uninitDevice

import org.usb4java.LibUsb; //导入方法依赖的package包/类
public void uninitDevice(DeviceHandle handle, byte iface) throws LibUsbException {
    int result = LibUsb.releaseInterface(handle, iface);
    if (result < 0) {
        System.err.println(String.format("failed to release interface %d.", iface));
        throw new LibUsbException("Failed to release interface", result);
    }
    LibUsb.close(handle);
}
 
开发者ID:kairyu,项目名称:flop,代码行数:9,代码来源:Dfu.java

示例15: releaseInterface

import org.usb4java.LibUsb; //导入方法依赖的package包/类
/**
 * Releases a claimed interface.
 * 
 * @param number
 *            The number of the interface to release.
 * @throws UsbException
 *             When interface could not be claimed.
 */
final void releaseInterface(final byte number) throws UsbException
{
    if (this.claimedInterfaceNumbers.isEmpty())
        throw new UsbClaimException("No interface is claimed");
    if (!this.claimedInterfaceNumbers.contains(number))
        throw new UsbClaimException("Interface not claimed");

    final DeviceHandle handle = open();
    int result = LibUsb.releaseInterface(handle, number & 0xff);
    if (result < 0)
    {
        throw ExceptionUtils.createPlatformException(
            "Unable to release interface", result);
    }

    if (this.detachedKernelDriver)
    {
        result = LibUsb.attachKernelDriver(handle, number & 0xff);
        if (result < 0)
        {
            throw ExceptionUtils.createPlatformException(
                "Unable to re-attach kernel driver", result);
        }
    }

    this.claimedInterfaceNumbers.remove(number);
}
 
开发者ID:usb4java,项目名称:usb4java-javax,代码行数:36,代码来源:AbstractDevice.java


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