1# USB服务子系统JS API变更 2 3OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,USB服务子系统的API变更如下: 4 5## 接口变更 6 7| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | 8|---|---|---|---| 9| ohos.usb | USBRequestDirection | USB_REQUEST_DIR_FROM_DEVICE = 0x80 | 新增 | 10| ohos.usb | USBRequestDirection | USB_REQUEST_DIR_TO_DEVICE = 0 | 新增 | 11| ohos.usb | USBControlRequestType | USB_REQUEST_TYPE_VENDOR | 新增 | 12| ohos.usb | USBControlRequestType | USB_REQUEST_TYPE_CLASS | 新增 | 13| ohos.usb | USBControlRequestType | USB_REQUEST_TYPE_STANDARD = 0 | 新增 | 14| ohos.usb | USBRequestTargetType | USB_REQUEST_TARGET_OTHER | 新增 | 15| ohos.usb | USBRequestTargetType | USB_REQUEST_TARGET_ENDPOINT | 新增 | 16| ohos.usb | USBRequestTargetType | USB_REQUEST_TARGET_INTERFACE | 新增 | 17| ohos.usb | USBRequestTargetType | USB_REQUEST_TARGET_DEVICE = 0 | 新增 | 18| ohos.usb | USBControlParams | data: Uint8Array; | 新增 | 19| ohos.usb | USBControlParams | index: number; | 新增 | 20| ohos.usb | USBControlParams | value: number; | 新增 | 21| ohos.usb | USBControlParams | reqType: USBControlRequestType; | 新增 | 22| ohos.usb | USBControlParams | target: USBRequestTargetType; | 新增 | 23| ohos.usb | USBControlParams | request: number; | 新增 | 24| ohos.usb | USBDevicePipe | devAddress: number; | 新增 | 25| ohos.usb | USBDevicePipe | busNum: number; | 新增 | 26| ohos.usb | USBDevice | configs: Array\<USBConfig>; | 新增 | 27| ohos.usb | USBDevice | protocol: number; | 新增 | 28| ohos.usb | USBDevice | subClass: number; | 新增 | 29| ohos.usb | USBDevice | clazz: number; | 新增 | 30| ohos.usb | USBDevice | productId: number; | 新增 | 31| ohos.usb | USBDevice | vendorId: number; | 新增 | 32| ohos.usb | USBDevice | version: string; | 新增 | 33| ohos.usb | USBDevice | productName: string; | 新增 | 34| ohos.usb | USBDevice | manufacturerName: string; | 新增 | 35| ohos.usb | USBDevice | name: string; | 新增 | 36| ohos.usb | USBDevice | serial: string; | 新增 | 37| ohos.usb | USBDevice | devAddress: number; | 新增 | 38| ohos.usb | USBDevice | busNum: number; | 新增 | 39| ohos.usb | USBConfig | interfaces: Array\<USBInterface>; | 新增 | 40| ohos.usb | USBConfig | isSelfPowered: boolean; | 新增 | 41| ohos.usb | USBConfig | isRemoteWakeup: boolean; | 新增 | 42| ohos.usb | USBConfig | name: string; | 新增 | 43| ohos.usb | USBConfig | maxPower: number; | 新增 | 44| ohos.usb | USBConfig | attributes: number; | 新增 | 45| ohos.usb | USBConfig | id: number; | 新增 | 46| ohos.usb | USBInterface | endpoints: Array\<USBEndpoint>; | 新增 | 47| ohos.usb | USBInterface | name: string; | 新增 | 48| ohos.usb | USBInterface | alternateSetting: number; | 新增 | 49| ohos.usb | USBInterface | subClass: number; | 新增 | 50| ohos.usb | USBInterface | clazz: number; | 新增 | 51| ohos.usb | USBInterface | protocol: number; | 新增 | 52| ohos.usb | USBInterface | id: number; | 新增 | 53| ohos.usb | USBEndpoint | interfaceId: number; | 新增 | 54| ohos.usb | USBEndpoint | type: number; | 新增 | 55| ohos.usb | USBEndpoint | number: number; | 新增 | 56| ohos.usb | USBEndpoint | direction: USBRequestDirection; | 新增 | 57| ohos.usb | USBEndpoint | maxPacketSize: number; | 新增 | 58| ohos.usb | USBEndpoint | interval: number; | 新增 | 59| ohos.usb | USBEndpoint | attributes: number; | 新增 | 60| ohos.usb | USBEndpoint | address: number; | 新增 | 61| ohos.usb | usb | closePipe(pipe: USBDevicePipe): number; | 新增 | 62| ohos.usb | usb | bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array,timeout?: number): Promise\<number>; | 新增 | 63| ohos.usb | usb | controlTransfer(pipe: USBDevicePipe, contrlparam: USBControlParams, timeout?: number): Promise\<number>; | 新增 | 64| ohos.usb | usb | getFileDescriptor(pipe: USBDevicePipe): number; | 新增 | 65| ohos.usb | usb | getRawDescriptor(pipe: USBDevicePipe): Uint8Array; | 新增 | 66| ohos.usb | usb | setInterface(pipe: USBDevicePipe, iface: USBInterface): number; | 新增 | 67| ohos.usb | usb | setConfiguration(pipe: USBDevicePipe, config: USBConfig): number; | 新增 | 68| ohos.usb | usb | releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number; | 新增 | 69| ohos.usb | usb | claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number; | 新增 | 70| ohos.usb | usb | requestRight(deviceName: string): Promise\<boolean>; | 新增 | 71| ohos.usb | usb | hasRight(deviceName: string): boolean; | 新增 | 72| ohos.usb | usb | connectDevice(device: USBDevice): Readonly\<USBDevicePipe>; | 新增 | 73| ohos.usb | usb | getDevices(): Array\<Readonly\<USBDevice>>; | 新增 | 74