# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MLA -- USB Library

20 December, 2013

- 1
- 2
…
- 116
- 117
- 118
- 119
- 120
…
- 311
- 312

Returns
uint8_t * - Pointer to the Device Descriptor.
Description
This function returns a pointer to the device descriptor of the requested device.
Remarks
This will need to be expanded to a full function when multiple device support is added.
Preconditions
None
Parameters
Parameters Description
uint8_t deviceAddress Address of device
Function
uint8_t * USBHostGetDeviceDescriptor( uint8_t deviceAddress )
1.4.2.1.1.26 USBHostGetStringDescriptor Macro
This routine initiates a request to obtains the requested string descriptor.
File
usb_host.h
Syntax
#define USBHostGetStringDescriptor( deviceAddress, stringNumber, LangID, stringDescriptor,
stringLength, clientDriverID ) \
USBHostIssueDeviceRequest( deviceAddress, USB_SETUP_DEVICE_TO_HOST |
USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_DEVICE, \
USB_REQUEST_GET_DESCRIPTOR, (USB_DESCRIPTOR_STRING << 8) |
stringNumber, \
LangID, stringLength, stringDescriptor, USB_DEVICE_REQUEST_GET,
clientDriverID )
Description
This routine initiates a request to obtains the requested string descriptor. If the request cannot be started, the routine returns
an error. Otherwise, the request is started, and the requested string descriptor is stored in the designated location.
Example Usage:
USBHostGetStringDescriptor(
deviceAddress,
stringDescriptorNum,
LangID,
stringDescriptorBuffer,
sizeof(stringDescriptorBuffer),
0xFF
);
while(1)
{
if(USBHostTransferIsComplete( deviceAddress , 0, &errorCode, &byteCount))
{
if(errorCode)
{
//There was an error reading the string, bail out of loop
}
else
{
//String is located in specified buffer, do something with it.
//The length of the string is both in the byteCount variable
1.4 Library Interface MLA - USB Library Help Embedded Host API
118

- 1
- 2
…
- 116
- 117
- 118
- 119
- 120
…
- 311
- 312