Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Need some help with camera usb-mass-storage and scsi
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
faz
n00b
n00b


Joined: 02 Nov 2002
Posts: 73
Location: the Netherlands

PostPosted: Sun Feb 09, 2003 12:43 pm    Post subject: Need some help with camera usb-mass-storage and scsi Reply with quote

Hi,

I'm having trouble getting my camera (a Sony DSC-P71 with a 128 MB memorystick) to work as a usb mass storage device.

I've read everything about it, both on the Net and on these forums, but I still can't get it to work.

I've rebuild my kernel with all the mentioned usb and scsi options build as modules:

Code:

CONFIG_USB
CONFIG_USB_DEVICEFS
CONFIG_USB_UHCI
CONFIG_USB_STORAGE

CONFIG_SCSI
CONFIG_BLK_DEV_SD
CONFIG_CHR_DEV_SG


note: SCSI emulation support for IDE is_not_ enabled

I have (among others) these modules loaded:

Code:

sd_mod                 10156   0  (unused)
hid                    12136   0  (unused)
usb-storage            21324   0  (unused)
scsi_mod               80292   1  [sd_mod usb-storage]
usb-uhci               20908   0  (unused)
usbcore                54816   1  [hid usb-storage usb-uhci]


No matter what I do, I don't get any devices in /dev/scsi. /proc/scsi/scsi gives "attached devices: none"

Iv'e seen some posts on this forum discussing entries in devfsd.conf for registering sd devices, but that's only for mapping those devices to /dev/scsi/... and that's keeps being empty on my box.

When I plug in the camera, i get this in the log:
Code:

Feb  7 13:04:16 [kernel] hub.c: USB new device connect on bus1/2, assigned device number 3
Feb  7 13:04:16 [kernel] usb.c: USB device 3 (vend/prod 0x54c/0x4e) is not claimed by any active driver.
Feb  7 13:04:19 [/etc/hotplug/usb.agent] Setup usbcam for USB product 54c/4e/120
Feb  7 13:04:19 [/etc/hotplug/usb.agent] Module setup usbcam for USB product 54c/4e/120
Feb  7 13:04:29 [kernel] Initializing USB Mass Storage driver...
Feb  7 13:05:03 [kernel] usb.c: USB disconnect on device 3
Feb  7 13:06:09 [kernel] usbdevfs: process 5261 (lsusb) did not claim interface 0 before use
Feb  7 13:06:14 [kernel] usbdevfs: process 5262 (lsusb) did not claim interface 0 before use


Obviously, i'm missing a essential step, but I can't figure out wich what.
Back to top
View user's profile Send private message
Ian Goldby
Guru
Guru


Joined: 18 May 2002
Posts: 539
Location: (Inactive member)

PostPosted: Sun Feb 09, 2003 9:38 pm    Post subject: Reply with quote

I have this working with my Casio. My notes on how I managed this are a bit sketchy, but this may help:

Vaguely relevant kernal config:
Code:
CONFIG_HOTPLUG=y
CONFIG_BLK_DEV_IDESCSI=m
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=m
CONFIG_SD_EXTRA_DEVS=40
CONFIG_BLK_DEV_SR=m
CONFIG_BLK_DEV_SR_VENDOR=y
CONFIG_SR_EXTRA_DEVS=2
CONFIG_CHR_DEV_SG=m
CONFIG_SCSI_DEBUG_QUEUES=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_FAT_FS=y
CONFIG_VFAT_FS=y
CONFIG_USB=y
CONFIG_USB_DEVICEFS=y
CONFIG_USB_UHCI_ALT=y
CONFIG_USB_STORAGE=m


Probably not all of those are necessary, and I'm not certain I've not missed anything, but if it helps, so much the better. There may be some entries needed in modules.conf, but I didn't have to change anything there. The IDE-SCSI might be for my CDRW and not needed for the camera. I'm pretty sure you need the FAT/VFAT bits though to read the DOS-format of the camera 'disk'.
Back to top
View user's profile Send private message
taskara
Advocate
Advocate


Joined: 10 Apr 2002
Posts: 3763
Location: Australia

PostPosted: Sun Feb 09, 2003 10:06 pm    Post subject: Reply with quote

I know this sounds stupid, but I read something about looking under /proc for usb devices...

at least you coudl
Code:
cat /proc/usb/devices
or something like that..
_________________
Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer!
Back to top
View user's profile Send private message
lsiden
Tux's lil' helper
Tux's lil' helper


Joined: 09 Feb 2003
Posts: 116
Location: Ann Arbor, MI, USA

PostPosted: Thu Feb 13, 2003 1:54 am    Post subject: Reply with quote

Not stupid at all! It's actually "cat /proc/bus/usb/devices", and on my sys it yields:

Quote:
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 0.00
S: Product=USB UHCI Root Hub
S: SerialNumber=e000
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=ff(vend.) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0553 ProdID=0202 Rev= 0.00
S: Manufacturer=STMicroelectronics
S: Product=USB Dual-mode Camera
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 70mA
I: If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
I: If#= 0 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
which isn't pleasant to read, I'll admit, but if you look closely, you'll see
Quote:
S: Manufacturer=STMicroelectronics
S: Product=USB Dual-mode Camera
which looks like pay-dirt.

Now I'm not out of the woods yet, b/c nothing appears under /dev/usb for this device. devfsd obviously fails to recognize anything.

Now I've had some pleasant private exchanges with another fellow in England who has exactly the kind of camera that I do (a cheap Cool-iCam CIC-175) for whom it worked "outa-da-box". He has a RedHat distrib, and accesses it with something called Video4Linux (I think). As for myself, I've installed sane-front/backends. Running either xcam or xscanimage does nothing. Both just seem to wait endlessly, without outputting any messages (I don't know whether they have a "verbose" mode - -v doesn't do anything for either utility).

So that's where I'm stuck right now. If anyone out there wants to offer their 2 cents, I'll be happy to send my /usr/src/linux/.config and the output of /proc/modules.

Thanks in advance.

-Larry
Back to top
View user's profile Send private message
taskara
Advocate
Advocate


Joined: 10 Apr 2002
Posts: 3763
Location: Australia

PostPosted: Thu Feb 13, 2003 4:44 am    Post subject: Reply with quote

there's a usb-storage (usb to scsi emulation) driver... is that loaded ?
_________________
Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer!
Back to top
View user's profile Send private message
lsiden
Tux's lil' helper
Tux's lil' helper


Joined: 09 Feb 2003
Posts: 116
Location: Ann Arbor, MI, USA

PostPosted: Thu Feb 13, 2003 4:16 pm    Post subject: Reply with quote

Quote:
there's a usb-storage (usb to scsi emulation) driver... is that loaded ?


Yep. It's there, alright.

Quote:
Code:

Module                  Size       Used by    Not tainted
ppa                       8600     0
usb-storage          21388   0 (unused)
.
.
.
Back to top
View user's profile Send private message
bertrand
n00b
n00b


Joined: 23 Sep 2002
Posts: 11
Location: Paris

PostPosted: Fri Feb 14, 2003 4:55 pm    Post subject: Reply with quote

make sure the module sd_mod is loaded and then use the rescan-scsi-bus.sh script every time you plug a new device:

Code:

#!/bin/bash
# Skript to rescan SCSI bus, using the
# scsi add-single-device mechanism
# (w) 98/03/19 Kurt Garloff <kurt@garloff.de> (c) GNU GPL

# Return hosts. /proc/scsi/HOSTADAPTER/? must exist
findhosts ()
{
  hosts=
  for name in /proc/scsi/*/?; do
    name=${name#/proc/scsi/}
    if test ! $name = scsi
      then hosts="$hosts ${name#*/}"
      echo "Host adapter ${name#*/} (${name%/*}) found."
    fi
  done
}

# Test if SCSI device $host $channen $id $lun exists
# Outputs description from /proc/scsi/scsi, returns new
testexist ()
{
  grepstr="scsi$host Channel: 0$channel Id: 0*$id Lun: 0$lun"
  new=`cat /proc/scsi/scsi|grep -e"$grepstr"`
  if test ! -z "$new"
    then cat /proc/scsi/scsi|grep -e"$grepstr"
    cat /proc/scsi/scsi|grep -A2 -e"$grepstr"|tail -2|pr -o4 -l1
  fi
}

# Perform search (scan $host)
dosearch ()
{
  for channel in $channelsearch; do
    for id in $idsearch; do
      for lun in $lunsearch; do
        new=
        devnr="$host $channel $id $lun"
        echo "Scanning for device $devnr ..."
        printf "OLD: "
        testexist
        if test ! -z "$remove" -a ! -z "$new"
          then echo "scsi remove-single-device $devnr" >/proc/scsi/scsi
          echo "scsi add-single-device $devnr" >/proc/scsi/scsi
          printf "\r\x1b[A\x1b[A\x1b[AOLD: "
          testexist
          if test -z "$new"; then printf "\rDEL: \r\n\n\n\n"; let rmvd+=1; fi
        fi
        if test -z "$new"
          then printf "\rNEW: "
          echo "scsi add-single-device $devnr" >/proc/scsi/scsi
          testexist
          if test -z "$new"; then printf "\r\x1b[A"; else let found+=1; fi
        fi
      done
    done
  done
}


# main
if test @$1 = @--help -o @$1 = @-h
  then
    echo "Usage: rescan-scsi-bus.sh [-l] [-w] [-c] [host [host ...]]"
    echo " -l activates scanning for LUNs 0 .. 7 [default: 0]"
    echo " -w enables scanning for device IDs 0 .. 15 [def.: 0 .. 7]"
    echo " -r enables removing of devices        [default: disabled]"
    echo " -c enables scanning of channels 0 1   [default: 0]"
    echo " If hosts are given, only these are scanned [default: all]"
    exit 0
fi

# defaults
lunsearch="0"
idsearch="0 1 2 3 4 5 6 7"
channelsearch="0"
remove=""

# Scan options
opt="$1"
while test ! -z "$opt" -a -z "${opt##-*}"; do
  opt=${opt#-}
  case "$opt" in
    l) lunsearch="0 1 2 3 4 5 6 7" ;;
    w) idsearch="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" ;;
    c) channelsearch="0 1" ;;
    r) remove=1 ;;
    *) echo "Unknown option -$opt !" ;;
  esac
  shift
  opt="$1"
done

# Hosts given ?
if test @$1 = @; then findhosts; else hosts=$*; fi

declare -i found=0
declare -i rmvd=0
for host in $hosts; do dosearch; done
echo "$found new device(s) found.               "
echo "$rmvd device(s) removed.                 "


Works fine for all my hot-plug devices (firewire&usb).
Back to top
View user's profile Send private message
lsiden
Tux's lil' helper
Tux's lil' helper


Joined: 09 Feb 2003
Posts: 116
Location: Ann Arbor, MI, USA

PostPosted: Fri Feb 14, 2003 8:26 pm    Post subject: Reply with quote

Don't mean to sound naive, but what do I have to set in menuconfig to build sd_mod.o?
Back to top
View user's profile Send private message
lsiden
Tux's lil' helper
Tux's lil' helper


Joined: 09 Feb 2003
Posts: 116
Location: Ann Arbor, MI, USA

PostPosted: Fri Feb 14, 2003 8:49 pm    Post subject: Reply with quote

Okay, I found what where to enable sd_mod.o. But I don't need to, it's already built into the kernel. Same for sg_mod.o (SCSI generic driver).

It occured to me that I must be lacking some low-level driver, but which one? There's a whole slew, but none of them in the menuconfig match "STM Microelectronics".

Thanks in adv.,
-Larry
Back to top
View user's profile Send private message
lsiden
Tux's lil' helper
Tux's lil' helper


Joined: 09 Feb 2003
Posts: 116
Location: Ann Arbor, MI, USA

PostPosted: Mon Feb 17, 2003 5:27 pm    Post subject: Reply with quote

Do I need to load sd_mod.o as a module? Won't it work if it's built into the kernel?
Back to top
View user's profile Send private message
norvalk
n00b
n00b


Joined: 21 Feb 2003
Posts: 49
Location: Ljubljana, Slovenia

PostPosted: Wed Feb 26, 2003 12:36 am    Post subject: Reply with quote

hi!

i also own sony dsc-p71 and i 'persuaded' it to work (as an usb mass storage device) by compiling the following options as modules:

* support for usb (config_usb)
- with built-in preliminary usb device filesystem (config_usb_devicefs)
* uhci support (config_usb_uhci) - 'cause my motherboard is equipped with via chipset
* usb mass storage (config_usb_storage)

the following modules are probably not needed in your configuration but i mention them nonetheless:

* usb hid support (config_usb_hid)
- with built-in hid input layer support (config_usb_hidinput)
* usb scanner support (config_usb_scanner)
* usb printer support (config_usb_printer)

as far as scsi support is concerned i selected the following options as modules:

* scsi support (config_scsi)
* scsi disk support (config_blk_dev_sd)
* scsi cdrom support (config_blk_dev_sr) - 'cause i use cd writter
* scsi generic support (config_chr_dev_sg)

and 'enabled extra checks in new queueing code' with 'verbose scsi error reporting' - but they're both optional.

after having compiled new modules, i did

Code:
modules-update


and put

Code:
usb-uhci


into my /etc/modules.autoload - this way the loading of any subsequently needed usb modules is done automatically.

next (as root) i created new mounting point by doing

Code:
mkdir /mnt/camera


and added new entry into my /etc/fstab:

Code:
/dev/sda1  /mnt/camera  vfat  noauto,user  0 0


this way any user is able to mount camera by issuing:

Code:
mount /mnt/camera


do note that you have to mount the right scsi device with the vfat filesystem option - in my case sda1. for hints on scsi devices use:

Code:
cdrecord -scanbus


and

Code:
ls -l /dev/sd*


i hope this will be of any help to you.

cheers


Last edited by norvalk on Wed Feb 26, 2003 9:03 am; edited 2 times in total
Back to top
View user's profile Send private message
faz
n00b
n00b


Joined: 02 Nov 2002
Posts: 73
Location: the Netherlands

PostPosted: Wed Feb 26, 2003 5:49 am    Post subject: Reply with quote

Well, I found my problem. To get you're camera to work with gphoto2 it has to be set to PTP USB mode. So that was what it was on when I tried to get it to work as a USB mass storage device. Turns out you have to put you're camera back to USB normal mode for this.

Nobdoy told me :cry:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum