js-apis-usb.md 20.6 KB
Newer Older
S
shawn_he 已提交
1
# USB
Z
zengyawen 已提交
2

S
shawn_he 已提交
3 4
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Z
zengyawen 已提交
5

S
shawn_he 已提交
6
## Modules to Import
Z
zengyawen 已提交
7 8 9 10 11

```
import usb from "@ohos.usb";
```

S
shawn_he 已提交
12
## usb.getDevices
Z
zengyawen 已提交
13

S
shawn_he 已提交
14
getDevices(): Array<Readonly<USBDevice>>
Z
zengyawen 已提交
15 16 17

Obtains the USB device list.

S
shawn_he 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
**System capability**: SystemCapability.USB.USBManager

- Return value
  | Type| Description|
  | -------- | -------- |
  | Array<Readonly<[USBDevice](#usbdevice)>> | Device information list.|

- Example
  ```
  let devicesList = usb.getDevices();
  console.log(`devicesList = ${JSON.stringify(devicesList)}`);
  // devicesList is a list of USB devices.
  // A simple example of devicesList is provided as follows:
  [
    {
      name: "1-1",
      serial: "",
      manufacturerName: "",
      productName: "",
      version: "",
      vendorId: 7531,
      productId: 2,
      clazz: 9,
      subclass: 0,
      protocol: 1,
      devAddress: 1,
      busNum: 1,
      configs: [
        {
          id: 1,
          attributes: 224,
          isRemoteWakeup: true,
          isSelfPowered: true,
          maxPower: 0,
          name: "1-1",
          interfaces: [
            {
              id: 0,
              protocol: 0,
              clazz: 9,
              subclass: 0,
              alternateSetting: 0,
              name: "1-1",
              endpoints: [
                {
                  address: 129,
                  attributes: 3,
                  interval: 12,
                  maxPacketSize: 4,
                  direction: 128,
                  number: 1,
                  type: 3,
                  interfaceId: 0,
                },
              ],
            },
          ],
        },
      ],
    },
  ]
  ```


## usb.connectDevice

S
shawn_he 已提交
84
connectDevice(device: USBDevice): Readonly<USBDevicePipe>
Z
zengyawen 已提交
85 86 87

Connects to a USB device.

S
shawn_he 已提交
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, and then call [usb.requestRight](#usbrequestright) to request the device access permission.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | device | [USBDevice](#usbdevice) | Yes| USB device information.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | Readonly<[USBDevicePipe](#usbdevicepipe)> | USB device pipe for data transfer.|

- Example
  ```
  let devicepipe= usb.connectDevice(device);
  console.log(`devicepipe = ${JSON.stringify(devicepipe)}`);
  ```


## usb.hasRight

S
shawn_he 已提交
111
hasRight(deviceName: string): boolean
S
shawn_he 已提交
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136

Checks whether the application has the permission to access the device.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | deviceName | string | Yes| Device name.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|

- Example
  ```
  let divicesName="1-1";
  let bool = usb.hasRight(divicesName);
  console.log(bool);
  ```


## usb.requestRight

S
shawn_he 已提交
137
requestRight(deviceName: string): Promise<boolean>
Z
zengyawen 已提交
138 139 140

Requests the temporary permission for the application to access the USB device.

S
shawn_he 已提交
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | deviceName | string | Yes| Device name.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | Promise<boolean> | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.|

- Example
  ```
  let divicesName="1-1";
  usb.requestRight(divicesName).then((ret) => {
    console.log(`requestRight = ${JSON.stringify(ret)}`);
  });
  ```


## usb.claimInterface

S
shawn_he 已提交
164
claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number
Z
zengyawen 已提交
165 166 167

Claims a USB interface.

S
shawn_he 已提交
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and USB interfaces, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
  | iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
  | force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|

- Example
  ```
  let ret = usb.claimInterface(devicepipe, interfaces);
  console.log(`claimInterface = ${ret}`);
  ```


## usb.releaseInterface

S
shawn_he 已提交
193
releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number
Z
zengyawen 已提交
194 195 196

Releases a USB interface.

S
shawn_he 已提交
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
Before you do this, ensure that you have claimed the interface by calling [usb.claimInterface](#usbclaiminterface).

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
  | iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|

- Example
  ```
  let ret = usb.releaseInterface(devicepipe, interfaces);
  console.log(`releaseInterface = ${ret}`);
  ```


## usb.setConfiguration

S
shawn_he 已提交
221
setConfiguration(pipe: USBDevicePipe, config: USBConfig): number
Z
zengyawen 已提交
222 223 224

Sets the device configuration.

S
shawn_he 已提交
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and device configuration, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
  | config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|

- Example
  ```
  let ret = usb.setConfiguration(devicepipe, config);
  console.log(`setConfiguration = ${ret}`);
  ```


## usb.setInterface

S
shawn_he 已提交
249
setInterface(pipe: USBDevicePipe, iface: USBInterface): number
Z
zengyawen 已提交
250 251 252

Sets a USB interface.

S
shawn_he 已提交
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and interfaces, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
  | iface | [USBInterface](#usbinterface) | Yes| USB interface to set.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|

- Example
  ```
  let ret = usb.setInterface(devicepipe, interfaces);
  console.log(`setInterface = ${ret}`);
  ```


## usb.getRawDescriptor

S
shawn_he 已提交
277
getRawDescriptor(pipe: USBDevicePipe): Uint8Array
Z
zengyawen 已提交
278 279 280

Obtains the raw USB descriptor.

S
shawn_he 已提交
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | Uint8Array | Raw descriptor data.|

- Example
  ```
  let ret = usb.getRawDescriptor(devicepipe);
  ```


## usb.getFileDescriptor

S
shawn_he 已提交
303
getFileDescriptor(pipe: USBDevicePipe): number
Z
zengyawen 已提交
304 305 306

Obtains the file descriptor.

S
shawn_he 已提交
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | number | File descriptor of the USB device.|

- Example
  ```
  let ret = usb.getFileDescriptor(devicepipe);
  ```


## usb.controlTransfer

S
shawn_he 已提交
329
controlTransfer(pipe: USBDevicePipe, contrlparam: USBControlParams, timeout?: number): Promise<number>
Z
zengyawen 已提交
330 331 332

Performs control transfer.

S
shawn_he 已提交
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
  | contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
  | timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | Promise<number> | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|

- Example
  ```
  usb.controlTransfer(devicepipe, USBControlParams).then((ret) => {
   console.log(`controlTransfer = ${JSON.stringify(ret)}`);
  })
  ```


## usb.bulkTransfer

S
shawn_he 已提交
359
bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout?: number): Promise<number>
Z
zengyawen 已提交
360 361 362

Performs bulk transfer.

S
shawn_he 已提交
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and endpoints, call [usb.requestRight](#usbrequestright) to request the device access permission, call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter, and call [usb.claimInterface](#usbclaiminterface) to claim the USB interface.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
  | endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
  | buffer | Uint8Array | Yes| Buffer for writing or reading data.|
  | timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | Promise<number> | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|

- Example
  ```
  // Call usb.getDevices to obtain a data set. Then, obtain a USB device and its access permission.
  // Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device.
  // Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer.
  usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => {
   console.log(`bulkTransfer = ${JSON.stringify(ret)}`);
  });
  ```


## usb.closePipe

S
shawn_he 已提交
393
closePipe(pipe: USBDevicePipe): number
Z
zengyawen 已提交
394 395 396

Closes a USB device pipe.

S
shawn_he 已提交
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.

**System capability**: SystemCapability.USB.USBManager

- Parameters
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|

- Return value
  | Type| Description|
  | -------- | -------- |
  | number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|

- Example
  ```
  let ret = usb.closePipe(devicepipe);
  console.log(`closePipe = ${ret}`);
  ```


## USBEndpoint

Represents the USB endpoint from which data is sent or received. You can obtain the USB endpoint through [USBInterface](#usbinterface).

| Name| Type| Description|
| -------- | -------- | -------- |
S
shawn_he 已提交
424 425 426 427 428 429 430 431
| address | number | Endpoint address.<br>**System capability**: SystemCapability.USB.USBManager|
| attributes | number | Endpoint attributes.<br>**System capability**: SystemCapability.USB.USBManager|
| interval | number | Endpoint interval.<br>**System capability**: SystemCapability.USB.USBManager|
| maxPacketSize | number | Maximum size of data packets on the endpoint.<br>**System capability**: SystemCapability.USB.USBManager|
| direction | [USBRequestDirection](#usbrequestdirection) | Endpoint direction.<br>**System capability**: SystemCapability.USB.USBManager|
| number | number | Endpoint number.<br>**System capability**: SystemCapability.USB.USBManager|
| type | number | Endpoint type.<br>**System capability**: SystemCapability.USB.USBManager|
| interfaceId | number | Unique ID of the interface to which the endpoint belongs.<br>**System capability**: SystemCapability.USB.USBManager|
S
shawn_he 已提交
432 433 434 435 436 437 438 439


## USBInterface

Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **USBInterface** instances, each providing a specific function.

| Name| Type| Description|
| -------- | -------- | -------- |
S
shawn_he 已提交
440 441 442 443 444 445 446
| id | number | Unique ID of the USB interface.<br>**System capability**: SystemCapability.USB.USBManager|
| protocol | number | Interface protocol.<br>**System capability**: SystemCapability.USB.USBManager|
| clazz | number | Device type.<br>**System capability**: SystemCapability.USB.USBManager|
| subClass | number | Device subclass.<br>**System capability**: SystemCapability.USB.USBManager|
| alternateSetting | number | Settings for alternating between descriptors of the same USB interface.<br>**System capability**: SystemCapability.USB.USBManager|
| name | string | Interface name.<br>**System capability**: SystemCapability.USB.USBManager|
| endpoints | Array&lt;[USBEndpoint](#usbendpoint)&gt; | Endpoints that belong to the USB interface.<br>**System capability**: SystemCapability.USB.USBManager|
S
shawn_he 已提交
447 448 449 450 451 452 453 454


## USBConfig

Represents the USB configuration. One [USBDevice](#usbdevice) can contain multiple **USBConfig** instances.

| Name| Type| Description|
| -------- | -------- | -------- |
S
shawn_he 已提交
455 456 457 458 459 460 461
| id | number | Unique ID of the USB configuration.<br>**System capability**: SystemCapability.USB.USBManager|
| attributes | number | Configuration attributes.<br>**System capability**: SystemCapability.USB.USBManager|
| maxPower | number | Maximum power consumption, in mA.<br>**System capability**: SystemCapability.USB.USBManager|
| name | string | Configuration name, which can be left empty.<br>**System capability**: SystemCapability.USB.USBManager|
| isRemoteWakeup | boolean | Support for remote wakeup.<br>**System capability**: SystemCapability.USB.USBManager|
| isSelfPowered | boolean | Support for independent power supplies.<br>**System capability**: SystemCapability.USB.USBManager|
| interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Supported interface attributes.<br>**System capability**: SystemCapability.USB.USBManager|
S
shawn_he 已提交
462 463 464 465 466 467 468 469


## USBDevice

Represents the USB device information.

| Name| Type| Description|
| -------- | -------- | -------- |
S
shawn_he 已提交
470 471 472 473 474 475 476 477 478 479 480 481 482
| busNum | number | Bus address.<br>**System capability**: SystemCapability.USB.USBManager|
| devAddress | number | Device address.<br>**System capability**: SystemCapability.USB.USBManager|
| serial | string | Device SN.<br>**System capability**: SystemCapability.USB.USBManager|
| name | string | Device name.<br>**System capability**: SystemCapability.USB.USBManager|
| manufacturerName | string | Device manufacturer.<br>**System capability**: SystemCapability.USB.USBManager|
| productName | string | Product information.<br>**System capability**: SystemCapability.USB.USBManager|
| version | string | Version.<br>**System capability**: SystemCapability.USB.USBManager|
| vendorId | number | Vendor ID.<br>**System capability**: SystemCapability.USB.USBManager|
| productId | number | Product ID.<br>**System capability**: SystemCapability.USB.USBManager|
| clazz | number | Device class.<br>**System capability**: SystemCapability.USB.USBManager|
| subClass | number | Device subclass.<br>**System capability**: SystemCapability.USB.USBManager|
| protocol | number | Device protocol code.<br>**System capability**: SystemCapability.USB.USBManager|
| configs | Array&lt;[USBConfig](#usbconfig)&gt; | Device configuration descriptor information.<br>**System capability**: SystemCapability.USB.USBManager|
S
shawn_he 已提交
483 484 485


## USBDevicePipe
Z
zengyawen 已提交
486 487 488

Represents a USB device pipe, which is used to determine a USB device.

S
shawn_he 已提交
489 490
| Name| Type| Description|
| -------- | -------- | -------- |
S
shawn_he 已提交
491 492
| busNum | number | Bus address.<br>**System capability**: SystemCapability.USB.USBManager|
| devAddress | number | Device address.<br>**System capability**: SystemCapability.USB.USBManager|
S
shawn_he 已提交
493 494 495


## USBControlParams
Z
zengyawen 已提交
496 497 498

Represents control transfer parameters.

S
shawn_he 已提交
499 500 501
| Name| Type| Description|
| -------- | -------- | -------- |
| request | number | Request type.|
S
shawn_he 已提交
502 503 504 505 506
| target | [USBRequestTargetType](#usbrequesttargettype) | Represents the request target type.<br>**System capability**: SystemCapability.USB.USBManager|
| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Request control type.<br>**System capability**: SystemCapability.USB.USBManager|
| value | number | Request parameters<br>**System capability**: SystemCapability.USB.USBManager|
| index | number | Index of the request parameter value.<br>**System capability**: SystemCapability.USB.USBManager|
| data | Uint8Array | Buffer for writing or reading data.<br>**System capability**: SystemCapability.USB.USBManager|
S
shawn_he 已提交
507 508 509 510 511 512 513


## USBRequestTargetType

Represents the request target type.


S
shawn_he 已提交
514
| Name| Default Value | Description|
S
shawn_he 已提交
515
| -------- | -------- | -------- |
S
shawn_he 已提交
516 517 518 519
| USB_REQUEST_TARGET_DEVICE | 0 | Device.<br>**System capability**: SystemCapability.USB.USBManager|
| USB_REQUEST_TARGET_INTERFACE | 1 | Interface.<br>**System capability**: SystemCapability.USB.USBManager|
| USB_REQUEST_TARGET_ENDPOINT | 2 | Endpoint<br>**System capability**: SystemCapability.USB.USBManager|
| USB_REQUEST_TARGET_OTHER | 3 | Others<br>**System capability**: SystemCapability.USB.USBManager|
S
shawn_he 已提交
520 521 522


## USBControlRequestType
Z
zengyawen 已提交
523 524 525

Enumerates control request types.

S
shawn_he 已提交
526
| Name| Default Value | Description|
S
shawn_he 已提交
527
| -------- | -------- | -------- |
S
shawn_he 已提交
528 529 530
| USB_REQUEST_TYPE_STANDARD | 0 | Standard<br>**System capability**: SystemCapability.USB.USBManager|
| USB_REQUEST_TYPE_CLASS | 1 | Class.<br>**System capability**: SystemCapability.USB.USBManager|
| USB_REQUEST_TYPE_VENDOR | 2 | Vendor<br>**System capability**: SystemCapability.USB.USBManager|
S
shawn_he 已提交
531 532 533


## USBRequestDirection
Z
zengyawen 已提交
534 535 536

Enumerates request directions.

S
shawn_he 已提交
537
| Name| Default Value | Description|
S
shawn_he 已提交
538
| -------- | -------- | -------- |
S
shawn_he 已提交
539 540
| USB_REQUEST_DIR_TO_DEVICE | 0 | Request for writing data from the host to the device.<br>**System capability**: SystemCapability.USB.USBManager|
| USB_REQUEST_DIR_FROM_DEVICE | 0x80 | Request for reading data from the device to the host.<br>**System capability**: SystemCapability.USB.USBManager|