Codota Logo
UsbDevice.getManufacturerName
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain UsbDevice
private void myMethod () {
UsbDevice u =
  • Codota IconIntent intent;String name;intent.getParcelableExtra(name)
  • Codota IconIntent intent;String name;(UsbDevice) intent.getParcelableExtra(name)
  • Smart code suggestions by Codota
}
origin: gigabytedevelopers/FireFiles

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static String getName(UsbDevice device){
  return Utils.hasLollipop() ? device.getManufacturerName() : nameForClass(device);
}
origin: kshoji/USB-MIDI-Driver

  /**
   * Get UsbDevice's manufacturer name
   *
   * @param usbDevice the UsbDevice
   * @param usbDeviceConnection the UsbDeviceConnection
   * @return the manufacturer name
   */
  @SuppressLint("NewApi")
  @Nullable
  public static String getManufacturerName(@NonNull UsbDevice usbDevice, @NonNull UsbDeviceConnection usbDeviceConnection) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      return usbDevice.getManufacturerName();
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
      byte[] rawDescriptors = usbDeviceConnection.getRawDescriptors();

      try {
        byte[] buffer = new byte[255];
        int indexOfManufacturerName = rawDescriptors[14] & 0xff;

        int manufacturerNameLength = usbDeviceConnection.controlTransfer(UsbConstants.USB_DIR_IN, USB_REQUEST_GET_DESCRIPTOR, (USB_DATA_TYPE_STRING << 8) | indexOfManufacturerName, 0, buffer, 255, 0);
        return new String(buffer, 2, manufacturerNameLength - 2, "UTF-16LE");
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
      }
    }

    return null;
  }
}
origin: alt236/USB-Device-Info---Android

  viewHolder.getReportedVendor().setText(device.getManufacturerName());
  viewHolder.getReportedProduct().setText(device.getProductName());
} else {
  loadAsyncData(viewHolder, vid, pid, device.getManufacturerName());
} else {
  loadAsyncData(viewHolder, vid, pid, null);
android.hardware.usbUsbDevicegetManufacturerName

Popular methods of UsbDevice

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

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now