Upload
magnus-jahnen
View
281
Download
0
Embed Size (px)
Citation preview
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
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
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
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
USB storage on Android Magnus Jahnen
Client Device Hierarchy
5
USB storage on Android Magnus Jahnen
Endpoints
• Unidirectional communication pipes
• Different types
• Control
• Interrupt
• Bulk
• Isochronous
6
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
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
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
USB storage on Android Magnus Jahnen
SCSI commands
• INQUIRY
• READ CAPACITY(10)
• READ(10)
• REQUEST SENSE
• TEST UNIT READY
• WRITE(10)
10
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
USB storage on Android Magnus Jahnen
General layout
12
%RRW�6HFWRU����E\WHV
)6�,QIRUPDWLRQ�6HFWRU����E\WHV
2SWLRQDO�UHVHUYHG�VHFWRUV
[� �����E\WHV
)$7V 'DWD�$UHDGLUHFWRULHV�DQG�ILOHV
5HVHUYHG�VHFWRUV
USB storage on Android Magnus Jahnen
FAT
13
����))))
��������
��������
��������
��������
����))))
����))))
(QWU\�1XPEHU9DOXH
)LOH������FOXVWHU�
)LOH������FOXVWHUV� )LOH������FOXVWHUV�
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
&OXVWHU��5RRW�'LUHFWRU\
&OXVWHU��)LOH�$
&OXVWHU��6XE�'LUHFWRU\�$�
&OXVWHU��)LOH�$
&OXVWHU��5RRW�'LUHFWRU\
5RRW�'LUHFWRU\����FOXVWHUV�
)LOH�$����FOXVWHUV�
USB storage on Android Magnus Jahnen
Implementation
15
partition
handling of partitionsand partition tables
fs
file system abstraction
driver
low level block device communication
USB storage on Android Magnus Jahnen
Driver package
16
uses
creates
ScsiInquiry+ScsiInquiry(): ctor+serialize(ByteBuffer buffer): void
CommandBlockWrapper#CommandBlockWrapper(...): ctor+serialize(ByteBuffer buffer): void
ScsiBlockDevice
BlockDeviceDriverFactory
«interface»BlockDeviceDriver
+init(): void+read(long deviceOffset, ByteBuffer buffer): void+write(long deviceOffset, ByteBuffer buffer): void+getBlockSize(): int
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
USB storage on Android Magnus Jahnen
Demonstration
18
USB storage on Android Magnus Jahnen
Thank you for your attention! Questions?
19
USB storage on Android Magnus Jahnen
Image resources (In the order they appear)
• http://diepresse.com/layout/diepresse/files/mobilesleben/android-logo.png
• http://developer.android.com/guide/topics/connectivity/usb/index.html
• https://play.google.com/store/apps/details?id=de.hechler.tcplugins.full.usb
• https://play.google.com/store/apps/details?id=com.homeysoft.nexususb.importer
• http://en.wikipedia.org/wiki/File:USB.png
• http://www.sprut.de/electronic/interfaces/usb/deskriptor.htm
• http://www.iconarchive.com/show/icons8-metro-style-icons-by-visualpharm/Computer-Hardware-Mouse-icon.html (http://www.visualpharm.com/)
• http://www.softicons.com/system-icons/web0.2ama-icons-by-chrfb/usb-stick-icon
• http://www.iconarchive.com/show/icons8-metro-style-icons-by-visualpharm/Phones-Headset-icon.html (http://www.visualpharm.com/)
• http://www.clker.com/cliparts/d/5/f/b/1195437711991895099Machovka_harddisk.svg.hi.png
• http://www.center.hu/images/cikkek/win95/win95logo.jpg
• http://ferienwohnungen-koehnke.de/kurbeitrag/
• http://www.tecnigen.com/wp-content/uploads/2013/07/usbandroid.png
20