Vaio running Linux and Sony DSC P1


On january 2001, I bought a nice digital camera, the Sony DSC P1. The only way to extract the pictures from this camera is via a memory stick reader or using the USB interface. Since the Vaio N505SN does not have a built-in memory stick slot, and there is, as of today, no linux support for it, I went for the USB option.

One of the best page about how to install Linux on a Vaio has been done by Hugo. Please refer to this page if you want a clean install. Then you can tweak it to extract pictures from the Sony cameras using the following things.

NEW! Wolfgang Daniel just sent me the modification needed to use a Sony DSC P5 on linux-2.2, see below for linux-2.2 instructions. Luckily enough, Cyril Bellot just sent me the configuration required for linux 2.4.19 and earlier kernels, the needed patch is described in the "2.4" section

Required configuration

I recently moved from a 2.2 kernel to a 2.4 one for the new wavelan module, it also gives read-write access on the memory stick. I am giving hints for both 2.2 and 2.4 kernels.

Configuration for a 2.4.x kernel

WARNING: Prior to 2.4.18 and after 2.4.10, USB was painfully slow. With 2.4.18 (and now 2.4.19) using USB to download pictures became as fast as with 2.4.10 and earlier kernels. That is what I am using right now, and I strongly recommend those kernels.

If you own a DSC P5 of plan to own one, and have a 2.4.19 kernel or earlier, you should update an include file in the kernel tree: drivers/usb/storage/unusual_devs.h. After the "DSC-S30/S70/S75/505V/F505" entry, add:

  UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0328,
                "Sony",
                "DSC-P5",
                US_SC_SCSI, US_PR_CB, NULL,
                US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE ),
    

You need to have kernel support for USB and SCSI, hotplug should also be there. Here is the configuration I have on my laptop for the 2.4.19 kernel:

[..]    
#
# General setup
#
[..]
CONFIG_HOTPLUG=y
[..]

#
# SCSI support
#
CONFIG_SCSI=m

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=m
CONFIG_SD_EXTRA_DEVS=40
# CONFIG_CHR_DEV_ST is not set
# CONFIG_CHR_DEV_OSST is not set
CONFIG_BLK_DEV_SR=m
CONFIG_BLK_DEV_SR_VENDOR=y
CONFIG_SR_EXTRA_DEVS=2
CONFIG_CHR_DEV_SG=m

#
# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
#
CONFIG_SCSI_DEBUG_QUEUES=y
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
# CONFIG_SCSI_LOGGING is not set

[..]
#
# USB support
#
CONFIG_USB=m
# CONFIG_USB_DEBUG is not set

#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_BANDWIDTH is not set
# CONFIG_USB_LONG_TIMEOUT is not set

#
# USB Host Controller Drivers
#
# CONFIG_USB_EHCI_HCD is not set
CONFIG_USB_UHCI=m
CONFIG_USB_UHCI_ALT=m
# CONFIG_USB_OHCI is not set

#
# USB Device Class drivers
#
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_EMI26 is not set
# CONFIG_USB_BLUETOOTH is not set
CONFIG_USB_STORAGE=m
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_STORAGE_DPCM is not set
# CONFIG_USB_STORAGE_HP8200e is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_ACM is not set
# CONFIG_USB_PRINTER is not set

[..]
#
# File systems
#
[..]
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
# CONFIG_UMSDOS_FS is not set
CONFIG_VFAT_FS=y
[..]

Now compile the new kernel, the modules, reboot with this new kernel. Note that you can choose to build scsi as modules also.

To have things working, you need to load some modules, here is the list of the required ones:

Once everything is loaded, and the camera plugged, you should have this:

hub.c: USB new device connect on bus1/1, assigned device number 5
usb.c: USB device 5 (vend/prod 0x54c/0x10) is not claimed by any active driver.
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
scsi0 : SCSI emulation for USB Mass Storage devices
  Vendor: Sony      Model: Sony DSC          Rev: 2.10
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 126848 512-byte hdwr sectors (65 MB)
sda: test WP failed, assume Write Enabled
 sda: sda1
WARNING: USB Mass Storage data integrity not assured
    

You can now mount /dev/sda1 as a msdos (FAT12) partition, and you can read the pictures, movies and such from the memory stick (the size is shown in the log, in this case I have a 64Mb one). With the 2.4 kernels you can also put files on the memory stick, useful if you want to give it to a lab to get real pictures out of it.

One annoying thing is the fact that usb-storage, when loaded make the load raise, while top says that the cpu is idling (which is true). To have to load back to a normal state, just unload and reload the usb-storage module. Note that this can be automagically done by using murasaki. I use it "out of the box" and it runs just perfectly.

I added an entry to allow the users to mount/unmount the camera, you just need to add:

/dev/sda1       /sony           msdos   defaults,noauto,user

to /etc/fstab. Be sure to unmount before unplugging or switching off the camera.

Configuration for a 2.2.x kernel

You need to have kernel support for USB and SCSI, also usb-storage requires you to select the development drivers in the first option of menuconfig. Here is the configuration I have on my laptop for the 2.2.19 kernel:

[..]
# 
# SCSI support
#
CONFIG_SCSI=m
CONFIG_BLK_DEV_SD=m
# CONFIG_CHR_DEV_ST is not set
CONFIG_BLK_DEV_SR=m
CONFIG_BLK_DEV_SR_VENDOR=y
CONFIG_CHR_DEV_SG=m 
CONFIG_SCSI_MULTI_LUN=y
# CONFIG_SCSI_CONSTANTS is not set
# CONFIG_SCSI_LOGGING is not set
[..]
#
# USB support
#
CONFIG_USB=m
# CONFIG_USB_DEBUG is not set
CONFIG_USB_DEVICEFS=y
CONFIG_HOTPLUG=y
# CONFIG_USB_BANDWIDTH is not set
CONFIG_USB_UHCI=m
# CONFIG_USB_UHCI_ALT is not set
# CONFIG_USB_OHCI is not set
# CONFIG_USB_PRINTER is not set
CONFIG_USB_SCANNER=m
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_ACM is not set
# CONFIG_USB_SERIAL is not set
# CONFIG_USB_IBMCAM is not set
# CONFIG_USB_OV511 is not set
# CONFIG_USB_DC2XX is not set
# CONFIG_USB_MDC800 is not set
CONFIG_USB_STORAGE=m
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_DABUSB is not set
# CONFIG_USB_PLUSB is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RIO500 is not set
# CONFIG_USB_DSBR is not set
# CONFIG_USB_BLUETOOTH is not set
# CONFIG_USB_KAWETH is not set
CONFIG_USB_HID=m
# CONFIG_USB_KBD is not set
# CONFIG_USB_MOUSE is not set
# CONFIG_USB_WACOM is not set
# CONFIG_USB_WMFORCE is not set
CONFIG_INPUT_KEYBDEV=m
CONFIG_INPUT_MOUSEDEV=m
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
CONFIG_INPUT_EVDEV=m
[..]
#
# Filesystems
#
[..]
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
# CONFIG_UMSDOS_FS is not set
CONFIG_VFAT_FS=y
[..]

As the list of devices is not complete, you have to add an entry in usb-storage.c. I duplicate here the information as is:

Add the following to usb-storage.c in the "unusual devices" list.

{ 0x054c, 0x0010, 0x0210,
  "Sony DSC", US_SC_SCSI, US_PR_CB,
  US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE | US_FL_ALT_LENGTH},

Using Wolfgang Daniel's patch, you will be able to use also a DSC P5, so add also:

{ 0x054c, 0x0010, 0x0328,
   "Sony DSC P5", US_SC_SCSI, US_PR_CB,
  US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE | US_FL_ALT_LENGTH},

You have everything now, let's compile!

To have things working, you need to load some modules, here is the list of the required ones:

Note that most of them are auto-loaded, so the first two only are required.

When the camera is plugged, dmesg should show you this:

usb.c: USB new device connect, assigned device number 2
scsi0 : SCSI emulation for USB Mass Storage devices
scsi : 1 host.
  Vendor: Sony      Model: Sony DSC          Rev: 2.10
  Type:   Direct-Access                      ANSI SCSI revision: 02
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2
Detected scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: hdwr sector= 512 bytes. Sectors= 126848 [61 MB] [0.1 GB]
usb-uhci.c: interrupt, status 3, frame# 1843
sda: test WP failed, assume Write Protected
 sda: sda1

You can now mount /dev/sda1 as a msdos (FAT12) partition, and you can read the pictures, movies and such from the memory stick (the size is shown in the log, in this case I have a 64Mb one). Note that it is not yet possible to erase files, you should take a look at 2.4 drivers, it should work with those ones.

One annoying thing is the fact that usb-storage, when loaded make the load raise, while top says that the cpu is idling (which is true). To have to load back to a normal state, just unload and reload the usb-storage module. Note that this can be automagically done by using usbmgr


(c) 2001 Yves Lafon
Last edited: $Id: usbdscp1.html,v 1.16 2003/08/31 19:41:19 ylafon Exp $