Helios64: Update USB page with USB Gadget under LK4.4

This commit is contained in:
Aditya Prayoga 2020-10-26 17:52:21 +07:00
parent 3626436edd
commit c520335912
13 changed files with 334 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

View File

@ -109,3 +109,337 @@ Using Type-C to Type A male cable such as,
![Type-C to Type-A male](/helios64/img/usb/typec_typea_male.jpg)
Helios64 can be used as Direct Attached Storage (DAS) with the required software configuration. It can also be used as "USB eMMC reader/writer" during system recovery mode.
## USB under U-Boot
### USB Host Port
USB Host support in U-Boot is quite minimal, it only support USB storage.
### USB OTG Port (USB Type-C)
USB Type C port is configured as USB device mode as USB Mass Storage connected to eMMC.
This function can be activated by pressing [Recovery Button](/helios64/button/#recovery-button).
This is to serve as a way to (re)install OS to eMMC.
## USB under Linux
!!! Info
Currently only applicable under Linux Kernel 4.4.
Mainline kernel support is still under development.
### Helios64 as Direct Attached Storage (DAS) device
Helios64 can be used as Direct Attached Storage (DAS) device with help of Linux USB Gadget kernel module.
The kernel moodule only export the underlying block device NOT the filesystem layer. Therefore if the block device is formatted with filesystem unique to Linux,
the exported disk may not readable by computer that has Helios64 connected to.
For example, the block device is formatted with EXT4 filesystem and Helios64 connected to Windows PC as DAS,
the Windows PC will not be able to read the disk content unless 3rd party software/driver installed.
!!! warning
Do NOT access Helios64 simultanouesly as DAS and NAS, as the filesystem is not managed by system and can lead to data corruption.
#### Individual Disk Exported as Separate Disk
To export all SATA disks that has been identified as /dev/sda ... /dev/sde, run the following command on Helios64.
```
sudo modprobe g_mass_storage file=/dev/sda,/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde iSerialNumber=1234567890 iManufacturer="Kobol Innovations" iProduct=Helios64
```
The following screenshot, Helios64 connected with 5x 120GB SATA drive.
***Helios64 connected to PC running Windows***
USB device visualization using USB Device Tree Viewer
![!usbtreeview Screenshot](/helios64/img/usb/linux_gadget_das_windows_usbtreeview.png)
Helios64 in Device Manager
![!device manager Screenshot](/helios64/img/usb/linux_gadget_das_windows_device_manager.png)
Disks detected under Disk Management
![!disk mgmt Screenshot](/helios64/img/usb/linux_gadget_das_windows_diskmgmt.png)
***Helios64 connected to PC running Linux***
USB device visualization using USBview
![!usbview Screenshot](/helios64/img/usb/linux_gadget_das_usbview.png)
USB tree using lsusb
![!lsusb tree Screenshot](/helios64/img/usb/linux_gadget_das_lsusb_tree.png)
```
$ sudo lsusb -s 2:6 -v
Bus 002 Device 006: ID 0525:a4a5 Netchip Technology, Inc. Pocketbook Pro 903
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 9
idVendor 0x0525 Netchip Technology, Inc.
idProduct 0xa4a5 Pocketbook Pro 903
bcdDevice 4.04
iManufacturer 3 Kobol Innovations
iProduct 4 Helios64
iSerial 5 1234567890
bNumConfigurations 1
OTG Descriptor:
bLength 3
bDescriptorType 9
bmAttributes 0x03
SRP (Session Request Protocol)
HNP (Host Negotiation Protocol)
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 47
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 126mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 1 Mass Storage
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 22
bNumDeviceCaps 2
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x00000006
Link Power Management (LPM) Supported
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x00
wSpeedsSupported 0x000f
Device can operate at Low Speed (1Mbps)
Device can operate at Full Speed (12Mbps)
Device can operate at High Speed (480Mbps)
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 1
Lowest fully-functional device speed is Full Speed (12Mbps)
bU1DevExitLat 1 micro seconds
bU2DevExitLat 500 micro seconds
Device Status: 0x0000
(Bus Powered)
```
xfce file manager (thunar)
![!Thunar Screenshot](/helios64/img/usb/linux_gadget_das_thunar_5_drive.png)
lsblk output:
```
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdc 8:32 0 111,8G 0 disk
└─sdc1 8:33 0 111,8G 0 part
sdd 8:48 0 111,8G 0 disk
└─sdd1 8:49 0 111,8G 0 part
sde 8:64 0 111,8G 0 disk
└─sde1 8:65 0 111,8G 0 part
sdf 8:80 0 111,8G 0 disk
└─sdf1 8:81 0 111,8G 0 part
sdg 8:96 0 111,8G 0 disk
└─sdg1 8:97 0 111,8G 0 part
$ lsblk -S
NAME HCTL TYPE VENDOR MODEL REV TRAN
sda 0:0:0:0 disk ATA WDC WDS240G2G0B 0000 sata
sdb 1:0:0:0 disk ATA TOSHIBA MQ04 0J sata
sdc 2:0:0:0 disk Linux File-Stor Gadget 0404 usb
sdd 2:0:0:1 disk Linux File-Stor Gadget 0404 usb
sde 2:0:0:2 disk Linux File-Stor Gadget 0404 usb
sdf 2:0:0:3 disk Linux File-Stor Gadget 0404 usb
sdg 2:0:0:4 disk Linux File-Stor Gadget 0404 usb
```
#### RAID device exported as One Disk
Assuming the RAID already created and identified as /dev/md/md-raid6, run the following command on Helios64 to export the RAID block device as USB Mass Storage
```
sudo modprobe g_mass_storage file=/dev/md/md-raid6 iManufacturer="Kobol Innovations" iProduct="Helios64" iSerialNumber="1234567890"
```
The following screenshot, Helios64 connected with 5x 120GB SATA drive and configured as RAID 6 so total space of the block device is ~360GB (3x 120GB). The block device then formatted with NTFS.
***Helios64 connected to PC running Windows***
USB device visualization using USB Device Tree Viewer
![!usbtreeview Screenshot](/helios64/img/usb/linux_gadget_das_windows_usbtreeview_raid.png)
Helios64 in Device Manager
![!device manager Screenshot](/helios64/img/usb/linux_gadget_das_windows_device_manager_raid.png)
Disks detected under Disk Management
![!disk mgmt Screenshot](/helios64/img/usb/linux_gadget_das_windows_diskmgmt_raid.png)
!!! note
Since the block device is formatted with NTFS, Windows can recognize it and assign drive letter E:
***Helios64 connected to PC running Linux***
USB device visualization using USBview
![!usbview Screenshot](/helios64/img/usb/linux_gadget_das_usbview_raid.png)
USB tree using lsusb
![!lsusb tree Screenshot](/helios64/img/usb/linux_gadget_das_lsusb_tree_raid.png)
```
Bus 002 Device 006: ID 0525:a4a5 Netchip Technology, Inc. Pocketbook Pro 903
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 9
idVendor 0x0525 Netchip Technology, Inc.
idProduct 0xa4a5 Pocketbook Pro 903
bcdDevice 4.04
iManufacturer 3 Kobol Innovations
iProduct 4 Helios64
iSerial 5 1234567890
bNumConfigurations 1
OTG Descriptor:
bLength 3
bDescriptorType 9
bmAttributes 0x03
SRP (Session Request Protocol)
HNP (Host Negotiation Protocol)
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 47
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 126mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 1 Mass Storage
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 22
bNumDeviceCaps 2
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x00000006
Link Power Management (LPM) Supported
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x00
wSpeedsSupported 0x000f
Device can operate at Low Speed (1Mbps)
Device can operate at Full Speed (12Mbps)
Device can operate at High Speed (480Mbps)
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 1
Lowest fully-functional device speed is Full Speed (12Mbps)
bU1DevExitLat 1 micro seconds
bU2DevExitLat 500 micro seconds
Device Status: 0x0000
(Bus Powered)
```
xfce file manager (thunar)
![!Thunar Screenshot](/helios64/img/usb/linux_gadget_das_thunar_raid.png)
lsblk output
```
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdc 8:32 0 335,2G 0 disk
└─sdc1 8:33 0 335,2G 0 part
$ lsblk -S
NAME HCTL TYPE VENDOR MODEL REV TRAN
sda 0:0:0:0 disk ATA WDC WDS240G2G0B 0000 sata
sdb 1:0:0:0 disk ATA TOSHIBA MQ04 0J sata
sdc 2:0:0:0 disk Linux File-Stor Gadget 0404 usb
```