Partager via


UsbManager.OpenAccessory(UsbAccessory) Method

Definition

Opens a file descriptor for reading and writing data to the USB accessory.

[Android.Runtime.Register("openAccessory", "(Landroid/hardware/usb/UsbAccessory;)Landroid/os/ParcelFileDescriptor;", "GetOpenAccessory_Landroid_hardware_usb_UsbAccessory_Handler")]
public virtual Android.OS.ParcelFileDescriptor? OpenAccessory (Android.Hardware.Usb.UsbAccessory? accessory);
[<Android.Runtime.Register("openAccessory", "(Landroid/hardware/usb/UsbAccessory;)Landroid/os/ParcelFileDescriptor;", "GetOpenAccessory_Landroid_hardware_usb_UsbAccessory_Handler")>]
abstract member OpenAccessory : Android.Hardware.Usb.UsbAccessory -> Android.OS.ParcelFileDescriptor
override this.OpenAccessory : Android.Hardware.Usb.UsbAccessory -> Android.OS.ParcelFileDescriptor

Parameters

accessory
UsbAccessory

the USB accessory to open

Returns

file descriptor, or null if the accessory could not be opened.

Attributes

Remarks

Opens a file descriptor for reading and writing data to the USB accessory.

If data is read from the java.io.InputStream created from this file descriptor all data of a USB transfer should be read at once. If only a partial request is read the rest of the transfer is dropped.

Java documentation for android.hardware.usb.UsbManager.openAccessory(android.hardware.usb.UsbAccessory).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to