Roland's homepage

My random knot in the Web

Using a Sony PRS-T2N e-reader with FreeBSD

date: 2015-08-08
reading time: 4 min.
category: howto
tags: ebooks

This article describes how to mount and transfer files to a Sony PRS-T2N.

In an earlier article I reviewed the Sony PRS-T2N. It seems this model has now been replaced by the PRS-T3, and Sony has stopped making E-readers.

Nevertheless I want to document how to mount it and transfer files to it. This howto is written for FreeBSD, but the commands for other BSD variants and Linux will be similar.

In this howto I will not be covering ebook software, even though that might have functionality to transfer ebooks.

Finding e-books

Many booksellers will sell e-books these days. Unfortunately some of those still come with cumbersome restrictions (DRM). Avoid them if you can.

A great source of free e-books is Project Gutenberg.

USB devices

The PRS-T2 represents itself on my system as three direct-access (disk-like) devices.

> dmesg
ugen4.2: <Sony> at usbus4
umass0: <Mass Storage> on usbus4
umass0:  SCSI over Bulk-Only; quirks = 0x4000
umass0:3:0:-1: Attached to scbus3
da0 at umass-sim0 bus 0 scbus3 target 0 lun 0
da0: <Sony PRS-T2N 2031> Removable Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
da0: quirks=0x2<NO_6_BYTE>
da1 at umass-sim0 bus 0 scbus3 target 0 lun 1
da1: <Sony PRS-T2N SD 2031> Removable Direct Access SCSI-2 device
da1: 40.000MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
da1: quirks=0x2<NO_6_BYTE>
da2 at umass-sim0 bus 0 scbus3 target 0 lun 2
da2: <Sony PRS-T2N Setup 2031> Removable Direct Access SCSI-2 device
da2: 40.000MB/s transfers
da2: Attempt to query device size failed: NOT READY, Medium not present
da2: quirks=0x2<NO_6_BYTE>

Furthermore I used the file command to look at these devices.

> file -s /dev/da*
/dev/da0: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkdosfs",
sectors/cluster 8, reserved sectors 38, Media descriptor 0xf8, sectors/track 16,
heads 4, sectors 2844288 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 2773,
serial number 0x4f03984c, label: "READER     "
/dev/da1: ERROR: cannot read `/dev/da1' (Device not configured)
/dev/da2: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkdosfs",
sectors/cluster 4, root entries 512, sectors 20480 (volumes <=32 MB) ,
Media descriptor 0xf8, sectors/FAT 20, sectors/track 32, heads 64,
serial number 0x510115d3, label: "SETUP      ", FAT (16 bit)

Looking at the descriptions, we can notice that;

  • da2 is labelled setup and is a MSDOS filesystem, probably containing the device’s system software.
  • da1 is labelled SD which probably stands for the micro-SD card that can be added. I don’t have one in my reader, hence the “not configured”.
  • da0 contains a MSDOS filesystem and is probably the internal storage. This is the device we want to mount.

Mounting

My automounter doesn’t recognize these devices because they don’t have a partition table, but that is not a big problem. To mount the da0 filesystem I use the following command.

> mount_msdosfs -u rsmith -g rsmith -m 644 -M 755 /dev/da0 /mnt/rsmith

You should replace rsmith with your username and /mnt/rsmith with a directory that belongs to you.

The built-in storage is approximately 1380 MiB.

> df -m /mnt/rsmith
Filesystem 1M-blocks Used Avail Capacity  Mounted on
/dev/da0        1386   39  1346     3%    /mnt/rsmith

Books location

The PRS-T2 stores e-books in the sub-directory Sony_Reader/media/books/. When it is mounted this becomes in my case /mnt/rsmith/Sony_Reader/media/books/. This is where you can copy your ebooks to. On the built-in “bookshelf” of the device, the epub files show their built-in titles, not the filename. Nevertheless I like to rename the epub files to something that resembles their title for better browsing of the books directory.

Currently, I have around 50 e-books on this device, using around 39 MiB. So I won’t be running out of space anytime soon!

Transferring files to the e-reader

As a backup and for convenience, I keep all my e-books in a directory on my workstation. When I find an interesting e-book, I put it there. And usually if I plug my e-header in via USB to charge it, I use the opportunity to transfer e-books to the reader.

My favorite tool for transferring files is the rsync program, because it can check on its own which files are missing in the target directory. It is used like this.

> rsync -av archive/epub/ /mnt/rsmith/Sony_Reader/media/books

Note that the source (first) directory should end with a slash, but the target should not.


For comments, please send me an e-mail.


Related articles


←  Checking links with linklint Using a scanner for macro photography  →