Tabnine Logo
UsbDevice.getProductName
Code IndexAdd Tabnine to your IDE (free)

How to use
getProductName
method
in
android.hardware.usb.UsbDevice

Best Java code snippets using android.hardware.usb.UsbDevice.getProductName (Showing top 4 results out of 315)

origin: kshoji/USB-MIDI-Driver

/**
 * Get UsbDevice's product name
 *
 * @param usbDevice the UsbDevice
 * @param usbDeviceConnection the UsbDeviceConnection
 * @return the product name
 */
@SuppressLint("NewApi")
@Nullable
public static String getProductName(@NonNull UsbDevice usbDevice, @NonNull UsbDeviceConnection usbDeviceConnection) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    return usbDevice.getProductName();
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
    byte[] rawDescriptors = usbDeviceConnection.getRawDescriptors();
    try {
      byte[] buffer = new byte[255];
      int indexOfProductName = rawDescriptors[15] & 0xff;
      int productNameLength = usbDeviceConnection.controlTransfer(UsbConstants.USB_DIR_IN, USB_REQUEST_GET_DESCRIPTOR, (USB_DATA_TYPE_STRING << 8) | indexOfProductName, 0, buffer, 255, 0);
      return new String(buffer, 2, productNameLength - 2, "UTF-16LE");
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
  }
  return null;
}
origin: DeviceConnect/DeviceConnect-Android

/**
 * USBをOpenする.
 */
private synchronized void openUsb(final UsbDevice usbDevice) {
  if (DEBUG) {
    Log.i(TAG, "----------------------------------------");
    Log.i(TAG, "Open USB.");
    Log.i(TAG, "DeviceName: " + usbDevice.getDeviceName());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Log.i(TAG, "DeviceProductName: " + usbDevice.getProductName());
    }
    Log.i(TAG, "----------------------------------------");
  }
  mParsingSysex = false;
  if (mFaBoUsbManager != null) {
    mFaBoUsbManager.closeConnection();
    mFaBoUsbManager.checkDevice(usbDevice);
    mFaBoUsbManager.connection(usbDevice);
  } else {
    mFaBoUsbManager = new FaBoUsbManager(mContext);
    mFaBoUsbManager.setParameter(FaBoUsbConst.BAUNDRATE_57600,
        FaBoUsbConst.PARITY_NONE,
        FaBoUsbConst.STOP_1,
        FaBoUsbConst.FLOW_CONTROL_OFF,
        FaBoUsbConst.BITRATE_8);
    mFaBoUsbManager.setListener(mInterface);
    mFaBoUsbManager.checkDevice(usbDevice);
    mFaBoUsbManager.connection(usbDevice);
  }
}
origin: gkasten/drrickorang

for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    if (entry.getValue().getProductName().contains("USB Audio")) {
      log(" USB Headset detected inside UsbManager, continue test");
      usb_available = true;
origin: alt236/USB-Device-Info---Android

  viewHolder.getReportedProduct().setText(device.getProductName());
} else {
  viewHolder.getReportedVendor().setText(R.string.not_provided);
android.hardware.usbUsbDevicegetProductName

Popular methods of UsbDevice

  • getVendorId
  • getProductId
  • getDeviceName
  • getInterfaceCount
  • getInterface
  • getDeviceClass
  • getDeviceId
  • getDeviceSubclass
  • getDeviceProtocol
  • equals
  • getManufacturerName
  • toString
  • getManufacturerName,
  • toString,
  • getConfiguration,
  • getConfigurationCount

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now