# 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
…
- 280
- 281
- 282
- 283
- 284
…
- 311
- 312

signed driver with inf file is created.
Once the driver is installed 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 Custom class USB peripheral
device. The data will arrive on the Bulk 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 Bulk OUT
endpoint) requesting the current pushbutton state. The firmware will process the received Get Pushbutton State command,
and will prepare an appropriate response packet depending upon the pushbutton state.
The PC then requests a packet of data from the device (which will be taken from the Bulk IN endpoint). Once the PC
application receives the response packet, it will update the pushbutton state label.
Try experimenting with the application by holding down the appropriate pushbutton on the demo board, and then
simultaneously clicking on the “Get Pushbutton State” button. Then try to repeat the process, but this time without holding
down the pushbutton on the demo board.
To make for a more fluid and gratifying end user experience, a real USB application would probably want to launch a
separate thread to periodically poll the pushbutton state, so as to get updates regularly. This is not done in this simple demo,
so as to avoid cluttering the PC application project with source code that is not related to USB communication.
In order to build the application, copy the file <libusb-win32 unzipped folder>\
libusb-win32-device-bin-0.1.12.1\lib\msvc\libusb.lib and paste to ‘lib’ folder of the VC++. Also copy the file
<libusb-win32 unzipped folder>\ libusb-win32-device-bin-0.1.12.1\ include\usb.h and paste to the “<Install Directory>\USB
Device - Libusb - Generic Driver Demo\Windows Application\Microsoft VC++ 2008 Express\SimpleLibusbDemo’ folder.
1.6.13.2 Linux
Running the demo on a Linux machine.
Description
The SimpleLibUSBDemo program and the associated firmware demonstrate how to use the Libusb device drivers 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 SimpleLibUSBDemo executable, you will need to have the libusb 0.1 driver installed on your
computer. The libusb can be downloaded from sourceforge.net.
The source code for SimpleLibUSBDemo.exe file was created using QT3 Designer. The source code can be found in the
“<Install Directory>\ USB Device - Libusb - Generic Driver Demo\Libusb Simple Demo - Linux Application\ Libusb Simple
Demo - Linux Application -QT3” directory.
To launch the application, open the Terminal and navigate to the “<Install Directory>\USB Device - LibUSB - Generic Driver
Demo\Linux Application” directory and execute the following commands
1. chmod a+x SimpleLibusbDemo_Linux (This command gives executable right to the file on this Linux computer
2. sudo ./SimpleLibusbDemo_Linux.
Enter the Super user password when requested. A window like that shown below should appear:
1.6 Demos MLA - USB Library Help Device - Vendor Driver Basic Demo
282

- 1
- 2
…
- 280
- 281
- 282
- 283
- 284
…
- 311
- 312