Search in sources :

Example 11 with UsbEndpoint

use of android.hardware.usb.UsbEndpoint in project android_frameworks_base by DirtyUnicorns.

the class UsbHostManager method addUsbInterface.

/* Called from JNI in monitorUsbHostBus() to report new USB interface for the device
       currently being added.  Returns true if successful, false in case of error.
     */
private void addUsbInterface(int id, String name, int altSetting, int Class, int subClass, int protocol) {
    if (mNewInterface != null) {
        mNewInterface.setEndpoints(mNewEndpoints.toArray(new UsbEndpoint[mNewEndpoints.size()]));
        mNewEndpoints.clear();
    }
    mNewInterface = new UsbInterface(id, altSetting, name, Class, subClass, protocol);
    mNewInterfaces.add(mNewInterface);
}
Also used : UsbEndpoint(android.hardware.usb.UsbEndpoint) UsbInterface(android.hardware.usb.UsbInterface)

Example 12 with UsbEndpoint

use of android.hardware.usb.UsbEndpoint in project assertj-android by square.

the class UsbRequestAssert method hasEndpoint.

public UsbRequestAssert hasEndpoint(UsbEndpoint endpoint) {
    isNotNull();
    UsbEndpoint actualEndpoint = actual.getEndpoint();
    // 
    assertThat(actualEndpoint).overridingErrorMessage("Expected endpoint <%s> but was <%s>.", endpoint, // 
    actualEndpoint).isEqualTo(endpoint);
    return this;
}
Also used : UsbEndpoint(android.hardware.usb.UsbEndpoint)

Example 13 with UsbEndpoint

use of android.hardware.usb.UsbEndpoint in project android_frameworks_base by crdroidandroid.

the class UsbHostManager method addUsbInterface.

/* Called from JNI in monitorUsbHostBus() to report new USB interface for the device
       currently being added.  Returns true if successful, false in case of error.
     */
private void addUsbInterface(int id, String name, int altSetting, int Class, int subClass, int protocol) {
    if (mNewInterface != null) {
        mNewInterface.setEndpoints(mNewEndpoints.toArray(new UsbEndpoint[mNewEndpoints.size()]));
        mNewEndpoints.clear();
    }
    mNewInterface = new UsbInterface(id, altSetting, name, Class, subClass, protocol);
    mNewInterfaces.add(mNewInterface);
}
Also used : UsbEndpoint(android.hardware.usb.UsbEndpoint) UsbInterface(android.hardware.usb.UsbInterface)

Example 14 with UsbEndpoint

use of android.hardware.usb.UsbEndpoint in project android_frameworks_base by crdroidandroid.

the class UsbHostManager method beginUsbDeviceAdded.

/* Called from JNI in monitorUsbHostBus() to report new USB devices
       Returns true if successful, in which case the JNI code will continue adding configurations,
       interfaces and endpoints, and finally call endUsbDeviceAdded after all descriptors
       have been processed
     */
private boolean beginUsbDeviceAdded(String deviceName, int vendorID, int productID, int deviceClass, int deviceSubclass, int deviceProtocol, String manufacturerName, String productName, int version, String serialNumber) {
    if (DEBUG) {
        Slog.d(TAG, "usb:UsbHostManager.beginUsbDeviceAdded(" + deviceName + ")");
        // Audio Class Codes:
        // Audio: 0x01
        // Audio Subclass Codes:
        // undefined: 0x00
        // audio control: 0x01
        // audio streaming: 0x02
        // midi streaming: 0x03
        // some useful debugging info
        Slog.d(TAG, "usb: nm:" + deviceName + " vnd:" + vendorID + " prd:" + productID + " cls:" + deviceClass + " sub:" + deviceSubclass + " proto:" + deviceProtocol);
    }
    if (isBlackListed(deviceName) || isBlackListed(deviceClass, deviceSubclass, deviceProtocol)) {
        return false;
    }
    synchronized (mLock) {
        if (mDevices.get(deviceName) != null) {
            Slog.w(TAG, "device already on mDevices list: " + deviceName);
            return false;
        }
        if (mNewDevice != null) {
            Slog.e(TAG, "mNewDevice is not null in endUsbDeviceAdded");
            return false;
        }
        // Create version string in "%.%" format
        String versionString = Integer.toString(version >> 8) + "." + (version & 0xFF);
        mNewDevice = new UsbDevice(deviceName, vendorID, productID, deviceClass, deviceSubclass, deviceProtocol, manufacturerName, productName, versionString, serialNumber);
        mNewConfigurations = new ArrayList<UsbConfiguration>();
        mNewInterfaces = new ArrayList<UsbInterface>();
        mNewEndpoints = new ArrayList<UsbEndpoint>();
    }
    return true;
}
Also used : UsbDevice(android.hardware.usb.UsbDevice) UsbInterface(android.hardware.usb.UsbInterface) UsbEndpoint(android.hardware.usb.UsbEndpoint) UsbConfiguration(android.hardware.usb.UsbConfiguration)

Aggregations

UsbEndpoint (android.hardware.usb.UsbEndpoint)14 UsbInterface (android.hardware.usb.UsbInterface)13 UsbDevice (android.hardware.usb.UsbDevice)5 PendingIntent (android.app.PendingIntent)4 Intent (android.content.Intent)4 UsbConfiguration (android.hardware.usb.UsbConfiguration)4 UsbDeviceConnection (android.hardware.usb.UsbDeviceConnection)4 Parcelable (android.os.Parcelable)1