Codota Logo
UsbDevice.getProductName
Code IndexAdd Codota 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)

  • 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: 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

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
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