Implementation of an Android Framework for USB storage access without root rights
Bachelor thesis
23.04.2014
Framework: https://github.com/mjdev/libaums
1. USB storage on Android Magnus Jahnen
USB mass storage
on Android
Implementation of an Android Framework for USB
storage access without root rights
1
Bachelor thesis
23.04.2014
2. USB storage on Android Magnus Jahnen
USB storage on Android
1. Introduction
2. Basics of USB
3. USB mass storage class
4. FAT32 file system
5. Implementation
6. Results
2
3. USB storage on Android Magnus Jahnen
Introduction
• USB features in Android since 3.1 Honeycomb
• Mass storage access: Currently two proprietary
applications available
• USB-Stick Plugin-TC (Plugin for Total Commander)
• Nexus Media Importer
3
4. USB storage on Android Magnus Jahnen
Basics of USB
• Stands for: Universal Serial Bus
• Standard by the USB Implementers forum
• Host (master) and multiple clients (slaves)
• Host powers the client and manages communication
process
• USB On the go as part of USB 2.0
4
5. USB storage on Android Magnus Jahnen
Client Device Hierarchy
5
6. USB storage on Android Magnus Jahnen
Endpoints
• Unidirectional communication pipes
• Different types
• Control
• Interrupt
• Bulk
• Isochronous
6
7. USB storage on Android Magnus Jahnen
USB mass storage class
• Determined by class and subclass in interface
descriptor
• Two different types
• Control/Bulk/Interrupt (CBI) [obsolete]
• Bulk-only transfer (BBB)
7
8. USB storage on Android Magnus Jahnen
Bulk-only transfer
• USB interface must have IN and OUT bulk endpoint
• Different protocols (specified by interface subclass)
• Reduced Block Commands (RBC)
• SCSI transparent command set (most commonly used)
8
9. USB storage on Android Magnus Jahnen
SCSI transparent command set
• Command Block Wrapper (CBW)
• Includes SCSI command
• Command Status Wrapper (CSW)
• Actual supported standard resp. SCSI commands
determined by issuing an INQUIRY
9
10. USB storage on Android Magnus Jahnen
SCSI commands
• INQUIRY
• READ CAPACITY(10)
• READ(10)
• REQUEST SENSE
• TEST UNIT READY
• WRITE(10)
10
11. USB storage on Android Magnus Jahnen
FAT32 file system
• Belongs to FAT family
• Developed by Microsoft
• Released in 1996 with Windows 95B
• Most commonly used on mass storage devices for
maximum compatibility
11
14. USB storage on Android Magnus Jahnen
Data Area
• Structured in clusters
• Directories and files
• Directories have a defined structure
• Files save raw data from user
14
15. USB storage on Android Magnus Jahnen
Implementation
15
partition
handling of partitions
and partition tables
fs
file system abstraction
driver
low level block
device communication
17. USB storage on Android Magnus Jahnen
Results
• Supported features:
• Bulk-only transfer
• FAT32 (MBR)
• Usual directory/file operations
• Features tested on various devices
• Requirements:
• Android 3.1 or later
• Hardware and software enabled USB host support
17