# 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
…
- 270
- 271
- 272
- 273
- 274
…
- 311
- 312

For more information about each demo board, please refer to the Demo Board Information section.
Demo Operation
This demo uses the selected hardware platform as a HID class USB device, but uses the HID class for general purpose I/O
operations. Typically, the HID class is used to implement human interface products, such as mice and keyboards. The HID
protocol is however quite flexible, and can be adapted and used to send/receive general purpose data to/from a USB device.
Using the HID class for general purpose I/O operations is quite advantageous, in that it does not require any kind of custom
driver installation process. HID class drivers are already provided by and are distributed with common operating systems.
Therefore, upon plugging in a HID class device into a typical computer system, no user installation of drivers is required, the
installation is fully automatic.
HID devices primarily communicate through one interrupt IN endpoint and one interrupt OUT endpoint. In most applications,
this effectively limits the maximum achievable bandwidth for full speed HID devices to 64kBytes/s of IN traffic, and
64kBytes/s of OUT traffic (64kB/s, but effectively “full duplex”).
The GenericHIDSimpleDemo.exe program, and the associated firmware demonstrate how to use the HID protocol for basic
general purpose USB data transfer. To make the PC source code as easy to understand as possible, the demo has
deliberately been made simple, and only sends/receives small amounts of data.
Before you can run the GenericHIDSimpleDemo.exe executable, you will need to have the Microsoft® .NET Framework
Version 2.0 Redistributable Package (later versions probably okay, but not tested) installed on your computer. Programs
which were built in the Visual Studio® .NET languages require the .NET redistributable package in order to run. The
redistributable package can be freely downloaded from Microsoft’s website. Users of Windows Vista® operating systems will
not need to install the .NET framework, as it comes pre-installed as part of the operating system.
The source code for GenericHIDSimpleDemo.exe file was created in Microsoft Visual C++® 2005 Express Edition. The
source code can be found in the “<Install Directory>\ USB Device - HID - Custom Demos\Generic HID - Simple Demo - PC
Software” directory. Microsoft currently distributes Visual C++ 2005 Express Edition for free, and can be downloaded from
Microsoft’s website. When downloading Microsoft Visual C++ 2005 Express Edition, also make sure to download and install
the Platform SDK, and follow Microsoft’s instructions for integrating it with the development environment.
It is not necessary to install either Microsoft Visual C++ 2005, or the Platform SDK in order to begin using the
GenericHIDSimpleDemo.exe program. These are only required if the source code will be modified or compiled.
To launch the application, simply double click on the executable “GenericHIDSimpleDemo.exe” in the “<Install
Directory>\USB Device - HID - Custom Demos” directory. A window like that shown below should appear:
If instead of this window, an error message pops up while trying to launch the application, it is likely the Microsoft .NET
Framework Version 2.0 Redistributable Package has not yet been installed. Please install it and try again.
In order to begin sending/receiving packets to the device, you must first find and “connect” to the device. As configured by
default, the application is looking for HID class USB devices with VID = 0x04D8 and PID = 0x003F. The device descriptor in
the firmware project meant to be used with this demo uses the same VID/PID. If you plug in a USB device programmed with
the correct precompiled .hex file, and hit the “Connect” button, the other pushbuttons should become enabled. If hitting the
connect button has no effect, it is likely the USB device is either not connected, or has not been programmed with the correct
firmware.
Hitting the Toggle LED(s) should send a single packet of general purpose generic data to the HID class USB peripheral
device. The data will arrive on the interrupt OUT endpoint. The firmware has been configured to receive this generic data
packet, parse the packet looking for the “Toggle LED(s)” command, and should respond appropriately by controlling the
LED(s) on the demo board.
The “Get Pushbutton State” button will send one packet of data over the USB to the peripheral device (to the interrupt OUT
endpoint) requesting the current pushbutton state. The firmware will process the received Get Pushbutton State command,
1.6 Demos MLA - USB Library Help Device - HID - Custom Demo
272

- 1
- 2
…
- 270
- 271
- 272
- 273
- 274
…
- 311
- 312