SCSI2SD - v5 hardware

model: SCSI2SD v5

storage: microSD card slot

power: 5V via standard molex connector, or via SCSI BUS (if the host provides power)

power consumption: 2.35W maximum (500 mA)

SCSI: SCSI-2 Narrow 8-bit, 50-pin connector.

USB: USB 2.0 micro-B

firmware: 4.6 (original: 4.4)

Links

SCSI2SD, files, User Manual, itead,

back to microcontrollers page.

History

2021-11-07: I re-created this page on my self-hosted web server.

2016-10-03: linux - f4 - scsi2sd-util - testing - I use a 4 GB microSD card for testing. In the log window:

22:25:47: SCSI2SD Ready, firmware version 4.6
22:25:47: SD Capacity (512-byte sectors): 7603200
SD CSD Register: 400e00325b5900001d6f7f800a4000a1
SD CID Register: 02544d53413034470621d77f8b00ab4f

and I can set it up as 1024 bytes sector size, 3801600 sectors, which is about 3.6 GB (3.62549) device size, according to scsi2sd-util.

2016-10-03: linux - f4 - scsi2sd-util - firmware upgrade. I noticed that new firmware was available. Disconnect scsi2sd device, start scsi2sd-util, select firmware upgrade from menu, select firmware file, plug in device. Afterwards, the logs says:

21:19:39: Firmware update successful
21:19:39: SCSI2SD Ready, firmware version 4.6
21:19:39: SD Capacity (512-byte sectors): 0
SD CSD Register: 00000000000000000000000000000000
SD CID Register: 00000000000000000000000000000000

great!

2016-10-03: linux - f4 - scsi2sd-util - now says "SCSI2SD Ready, firmware version 4.4", and in the log window:

21:11:55: SCSI2SD Ready, firmware version 4.4
21:11:55: SD Capacity (512-byte sectors): 0
SD CSD Register: 00000000000000000000000000000000
SD CID Register: 00000000000000000000000000000000

nice.

2016-10-03: linux - f4 - when connected, the SCSI2SD v5 shows up in dmesg like this:

tingo@kg-f4:~$ dmesg | tail -8
[1129071.411605] usb 5-4: new full-speed USB device number 5 using ohci-pci
[1129071.586716] usb 5-4: New USB device found, idVendor=04b4, idProduct=1337
[1129071.586735] usb 5-4: New USB device strings: Mfr=2, Product=1, SerialNumber=128
[1129071.586744] usb 5-4: Product: SCSI2SD
[1129071.586753] usb 5-4: Manufacturer: codesrc.com
[1129071.586761] usb 5-4: SerialNumber: 1234
[1129071.596944] hid-generic 0003:04B4:1337.0007: hidraw2: USB HID v1.11 Device [codesrc.com SCSI2SD] on usb-0000:00:13.0-4/input0
[1129071.604992] hid-generic 0003:04B4:1337.0008: hidraw3: USB HID v1.11 Device [codesrc.com SCSI2SD] on usb-0000:00:13.0-4/input1

and scsi2sd-util finds it. But - it also gives error messages:

tingo@kg-f4:~$ dl/scsi2sd-util
Error opening HID device /dev/hidraw2

Error opening HID device /dev/hidraw2

Error opening HID device /dev/hidraw2

Error opening HID device /dev/hidraw2

Error opening HID device /dev/hidraw2

Error opening HID device /dev/hidraw2

Error opening HID device /dev/hidraw2

Error opening HID device /dev/hidraw2

Error opening HID device /dev/hidraw2

until I quit it. Ok, it is a permissions problem, I fixed it by following the first answer in this thread. I created this file:

tingo@kg-f4:~$ cat /etc/udev/rules.d/99-hidraw-permissions.rules
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"

and unplugged / plugged the SCSI2SD device. Looks better now:

tingo@kg-f4:~$ ls -l /dev/hid*
crw------- 1 root root    251, 0 Sep 20 19:08 /dev/hidraw0
crw------- 1 root root    251, 1 Sep 20 19:08 /dev/hidraw1
crw-rw-r-- 1 root plugdev 251, 2 Oct  3 21:07 /dev/hidraw2
crw-rw-r-- 1 root plugdev 251, 3 Oct  3 21:07 /dev/hidraw3

ok.

2016-10-03: linux - I have another machine, this one with Ubuntu on:

tingo@kg-f4:~$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:    trusty
tingo@kg-f4:~$ uname -a
Linux kg-f4 3.13.0-79-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

will the precompiled scsi2sd-util work there? get it

tingo@kg-f4:~/dl$ wget http://www.codesrc.com/files/scsi2sd/latest/linux/scsi2sd-util
--2016-10-03 20:30:52--  http://www.codesrc.com/files/scsi2sd/latest/linux/scsi2sd-util
Resolving www.codesrc.com (www.codesrc.com)... 54.208.106.85
Connecting to www.codesrc.com (www.codesrc.com)|54.208.106.85|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10337043 (9.9M)
Saving to: ‘scsi2sd-util’

100%[===========================================================================================>] 10,337,043  5.94MB/s   in 1.7s  

2016-10-03 20:30:55 (5.94 MB/s) - ‘scsi2sd-util’ saved [10337043/10337043]

make it executable

tingo@kg-f4:~/dl$ chmod u+x scsi2sd-util

try it

tingo@kg-f4:~/dl$ ./scsi2sd-util
20:32:24: Error: Unable to initialize GTK+, is DISPLAY set properly?

Hmm, this might actually work. I tried with X forwarding (ssh -X) and yes, it does work.

2016-10-02: linux - does the precompiled utilities work on my Fedora laptop?

[tingo@localhost ~]$ cat /etc/fedora-release
Fedora release 23 (Twenty Three)
[tingo@localhost ~]$ uname -a
Linux localhost.localdomain 4.5.7-200.fc23.x86_64 #1 SMP Wed Jun 8 17:41:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

get the software:

[tingo@localhost linux]$ pwd
/home/tingo/doc/SCSI2SD/v5/linux
[tingo@localhost linux]$ wget http://www.codesrc.com/files/scsi2sd/latest/linux/scsi2sd-util
--2016-10-02 21:11:04--  http://www.codesrc.com/files/scsi2sd/latest/linux/scsi2sd-util
Resolving www.codesrc.com (www.codesrc.com)... 54.208.106.85
Connecting to www.codesrc.com (www.codesrc.com)|54.208.106.85|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10337043 (9.9M)
Saving to: ‘scsi2sd-util’

scsi2sd-util                             100%[===============================================================================>]   9.86M  1.45MB/s    in 8.9s    

2016-10-02 21:11:14 (1.11 MB/s) - ‘scsi2sd-util’ saved [10337043/10337043]

is it a program file?

[tingo@localhost linux]$ file s*
scsi2sd-util: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.26, BuildID[sha1]=03e50ba21573477e54084f945441a01a813a7389, not stripped

yes. Fix permissions:

[tingo@localhost linux]$ chmod u+x scsi2sd-util

test

[tingo@localhost linux]$ ./scsi2sd-util
./scsi2sd-util: error while loading shared libraries: libudev.so.0: cannot open shared object file: No such file or directory

ok, so it doesn't work.

2016-09-27: building - unfortunately, building fails while starting to build libzipper:

[...]
gmake[1]: Leaving directory '/zs/tingo/work/scsi2sd/SCSI2SD/software/build/freebsd/wx'
mkdir -p /home/tingo/work/scsi2sd/SCSI2SD/software/build/freebsd/libzipper/
( \
    cd /home/tingo/work/scsi2sd/SCSI2SD/software/build/freebsd/libzipper/ && \
    /zs/tingo/work/scsi2sd/SCSI2SD/software/scsi2sd-util/libzipper-1.0.4/configure --disable-shared LDFLAGS="-L../zlib" CPPFLAGS="-I../zlib" --disable-shared -enable-static && \
    gmake libzipper.la \
) && \
touch /home/tingo/work/scsi2sd/SCSI2SD/software/build/freebsd/libzipper/buildstamp
checking build system type... x86_64-unknown-freebsd9.3
checking host system type... x86_64-unknown-freebsd9.3
checking target system type... x86_64-unknown-freebsd9.3
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /zs/tingo/work/scsi2sd/SCSI2SD/software/scsi2sd-util/libzipper-1.0.4/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of c++... gcc3
checking how to print strings... printf
checking for gcc... cc
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking whether cc understands -c and -o together... yes
checking dependency style of cc... gcc3
checking for a sed that does not truncate output... /usr/local/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... no
checking how to convert x86_64-unknown-freebsd9.3 file names to x86_64-unknown-freebsd9.3 format... func_convert_file_noop
checking how to convert x86_64-unknown-freebsd9.3 file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... cc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd9.3 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... c++ -E
checking for ld used by c++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking for c++ option to produce PIC... -fPIC -DPIC
checking if c++ PIC flag -fPIC -DPIC works... yes
checking if c++ static flag -static works... yes
checking if c++ supports -c -o file.o... yes
checking if c++ supports -c -o file.o... (cached) yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd9.3 ld.so
checking how to hardcode library paths into programs... immediate
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... no
checking for pread... yes
checking for pwrite... yes
checking for utimes... yes
checking for localtime_r... yes
checking for doxygen... no
configure: WARNING: doxygen not found - will not generate any doxygen documentation
checking for perl... /usr/local/bin/perl
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for ZLIB... no
configure: error: zlib 1.2.3 or newer not found.
gmake: *** [Makefile:168: /home/tingo/work/scsi2sd/SCSI2SD/software/build/freebsd/libzipper/buildstamp] Error 1
gmake: Leaving directory '/zs/tingo/work/scsi2sd/SCSI2SD/software/scsi2sd-util'

ok, I must fix that.

2016-09-27: patched files look like this

tingo@kg-core1$ diff -u build.sh.orig build.sh
--- build.sh.orig    2016-09-27 20:24:40.722414000 +0200
+++ build.sh    2016-09-27 22:19:37.145430000 +0200
@@ -20,6 +20,16 @@
     fi
 ;;

+FreeBSD)
+    gmake -C scsi2sd-util
+
+    if [ $? -eq 0 ]; then
+        mkdir -p build/freebsd
+
+        cp scsi2sd-util/build/freebsd/scsi2sd-util build/freebsd
+    fi
+;;
+
 Darwin)
     make -C scsi2sd-util

and

tingo@kg-core1$ diff -u scsi2sd-util/Makefile.orig scsi2sd-util/Makefile
--- scsi2sd-util/Makefile.orig    2016-09-27 20:24:40.729937000 +0200
+++ scsi2sd-util/Makefile    2016-09-27 22:18:11.763707000 +0200
@@ -81,6 +81,13 @@
     WX_CONFIG += --with-macosx-version-min=10.7
     BUILD := $(PWD)/build/mac
 endif
+ifeq ($(TARGET),FreeBSD)
+    VPATH += hidapi/libusb
+    LDFLAGS += -lusb -lexpat
+        CXXFLAGS += -std=c++11
+        CXX=c++
+    BUILD := $(PWD)/build/freebsd
+endif

 export CC CXX

ok.

2016-09-27: get sources onto my main workstation, which runs FreeBSD:

tingo@kg-core1$ uname -a
FreeBSD kg-core1.kg4.no 9.3-STABLE FreeBSD 9.3-STABLE #3 r304838: Fri Aug 26 12:11:25 CEST 2016
     root@kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64

prepare

tingo@kg-core1$ cd ~/work/
tingo@kg-core1$ mkdir scsi2sd
tingo@kg-core1$ cd scsi2sd

get sources

tingo@kg-core1$ git clone --recursive git://www.codesrc.com/git/SCSI2SD
Cloning into 'SCSI2SD'...
remote: Counting objects: 13174, done.
remote: Compressing objects: 100% (8656/8656), done.
remote: Total 13174 (delta 6047), reused 10713 (delta 4249)
Receiving objects: 100% (13174/13174), 44.58 MiB | 3.37 MiB/s, done.
Resolving deltas: 100% (6047/6047), done.
Checking connectivity... done.

ok. While searching to see if anybody has compiled this for FreeBSD, I found that grehan has patches, better get them:

tingo@kg-core1$ pwd
/home/tingo/work/scsi2sd
tingo@kg-core1$ fetch https://people.freebsd.org/~grehan/scsi2sd/scsi2sd.diff
scsi2sd.diff                                  100% of 2973  B   35 MBps 00m00s
tingo@kg-core1$ fetch https://people.freebsd.org/~grehan/scsi2sd/scsi2sd_hidapi.diff
scsi2sd_hidapi.diff                           100% of  490  B 5834 kBps 00m00s

see if patches will work: smallest patch first

tingo@kg-core1$ cd SCSI2SD/software/scsi2sd-util/hidapi/libusb/
tingo@kg-core1$ patch -C -p2 < ../../../../../scsi2sd_hidapi.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/libusb/hid.c b/libusb/hid.c
|index 6c1d247..19da8e9 100644
|--- a/libusb/hid.c
|+++ b/libusb/hid.c
--------------------------
Patching file hid.c using Plan A...
Hunk #1 succeeded at 250.
done

yes, so patch

tingo@kg-core1$ patch  -p2 < ../../../../../scsi2sd_hidapi.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/libusb/hid.c b/libusb/hid.c
|index 6c1d247..19da8e9 100644
|--- a/libusb/hid.c
|+++ b/libusb/hid.c
--------------------------
Patching file hid.c using Plan A...
Hunk #1 succeeded at 250.
done

good. How about the larger patch?

tingo@kg-core1$ cd ~/work/scsi2sd/SCSI2SD
tingo@kg-core1$ patch -C -p1 < ../scsi2sd.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/software/bootloaderhost/Makefile b/software/bootloaderhost/Makefile
|index 0273813..8c104be 100644
|--- a/software/bootloaderhost/Makefile
|+++ b/software/bootloaderhost/Makefile
--------------------------
File to patch:

nope, that one is too old. So I manually patched software/build.sh and software/scsi2sd-util/Makefile, will see if that works.

2016-09-22: the package from itead arrived, straight into my mailbox.

2016-09-05: I ordered 1 x SCSI2SD v5 from itead (China). Price was USD 70.- and shipping USD 4.52, a total of USD 74.52. Specifications: - SCSI: asynchronous transfers only - SD card interface: microSD, tested up to 64 GB, communication via SPI at 25 MHz (3 MB/s theoretcial max) - USB interface: USB 2.0 micro-B, for firmware updates and configuration - power: 5V via standard Molex 4-pin, or via SCSI host termination power. 2.35W maximum (500mA). Do not connect 12V! - size: 5 cm x 10 cm x 1.5 cm - performance: up to 2.6 MB/s read, 2.3 MB/s write