本文整理汇总了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;
}
示例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);
}
示例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);
}
}
示例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() );
}
}
示例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;
}
}
示例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));
}
}
示例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;
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
示例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;
}
}
示例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) + "]");
}
}
示例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 ) + "]" );
}
}
示例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);
}
示例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);
}