# devfs usb-storage and scsi

## Ozymandias

hi there,

I am the lucky owner of a NEX II mp3 player, which can also be used as a portable harddisk via usb and usb-storage. Only whenever I plug it in, devfs doesn't create the needed links. I need a part? in /dev/scsi/host?/bus?/target?/lun?/part? but it never show's until I create anywhere, and mount via, a block device with major 8 and minor 1 (sda1). Then all of a sudden devfs is showing the scsi device part? and disc. How can I tell devfs to do this automatic? I tried putting in devfsd.conf the lines:

```

REGISTER        scsi/host.*/bus.*/target.*/lun.*/.* MKOLDCOMPAT

UNREGISTER      scsi/host.*/bus.*/target.*/lun.*/.* RMOLDCOMPAT

```

and tried other (sensible and not so sensible) things here, nothing works.

How can I force devfs to create the needed devices? any idea's anyone?

I don't want to use the sda1 because I use a hotplug script and have multiple changing scsi device's (ide-scsi cdrom burner). So this script checks where the NEX II gets connected and mounts that .. but the devices never show up, until I mount them from somewhere else. 

greetz Ozy

----------

## pablored

Did you ever get your NEX sorted? 

I am considering purchasing one, any advice now that you have had the player a while?

Thanks.

----------

## Ozymandias

Yes, It works quite well, only it doesn't get automatically automounted allways, sometimes I have to do It by hand. I like my Nex II, I've seen better players, but most of them have DRM or need a proprietory interface/driver. The good thing about the Nex II is that you plug it in the USB and it works. Quality of the player is good, not superb, but it is a mp3 player, you cannot want super audio quality from it. It is small, solid state, so I use it for jogging and traveling. It kan take any type of data, so you can use it as a little harddisk as whell, which is quite an advantage. I do think that the interface is a but clumsy and badly designed. Not that it is unusable, just clumsy. But the good thing is that I asked them if I could develop for them, they seriously thought about it, we emailed a lot, but it would cost them to much, because I would need a special expensive developers enviroment. But they did take my suggestions seriously, and to come to my point here: There is a change that sooner or later they will release another firmware update which contains some of the things I suggested. 

greetz Ozy

----------

## pablored

Nice to hear.  Impressive manufacturer communication!

I currently have a DAP PRO (old korean born player) that has little chance of ever forming linux relations.  I put the two together but they didn't talk much  :Sad: .  

I do like the look of the NEX, I wish all mp3 players were CF based with no internal memory.  Really, I just need a small tough player with 128mb to use at the gym... that works in linux.

----------

## reverius42

"I need a part? in /dev/scsi/host?/bus?/target?/lun?/part? but it never show's until I create anywhere, and mount via, a block device with major 8 and minor 1 (sda1)" ...

I have a usb-scsi device (CompactFlash card reader), and I know it works (it is identified and modules are loaded), but I do not see any "part" in that directory. What command did you use to create a block device w/ major 8 and minor 1? I think I need to do that.

----------

## Pavan

 *reverius42 wrote:*   

> 
> 
> I have a usb-scsi device (CompactFlash card reader), and I know it works (it is identified and modules are loaded), but I do not see any "part" in that directory. What command did you use to create a block device w/ major 8 and minor 1? I think I need to do that.

 

I have a Sandisk CF reader & modules are not loaded automatically. What do I need to do? I only have the usb-controller alias in the /etc/modules.d/i386 file. I've not done any other settings.

-Pavan

----------

## Ozymandias

you need to compile usb-storage in the usb section, and in the scsi section, you need vendor specific functions and scsi-generic will be helpful (best to do all of these as modules)

then add usb-storage in modules.autoload and maybe scsi-generic in modules.autoload

to make a block (or character) device:

mknod sda1 b 8 1

or sdb1:

mknod sdb1 b 8 17

greetz Ozy

----------

## Pavan

Yeah, may be I need to autoload usb-storage. Will check it out.

When I 1st tried it, I loaded usb-storage manually. As mentioned by u, the devfs did not show the partitions. The syslog also did not show the partitions. But when I did a mount /dev/sda1 ...., it automatically created the part files in devfs & also logged in the syslog.

How do I do a automount?

-Pavan

----------

## Ozymandias

 *Pavan wrote:*   

> How do I do a automount?
> 
> 

 

if only I knew  :Smile: 

greetz Ozy

ps you can check usb-storage with the command dmesg, which lists all recent kernel messages ..

----------

## yannick

This is a copy-paste of a message I wrote in this thread https://forums.gentoo.org/viewtopic.php?t=15334 over cameras using usb-storage, I think it should apply here too :

Hi,

it is really simple (though I spent a night to find how to use all the functionnality of hotplug) :

Install hotplug and create a new file /etc/hotplug/usb/usb-storage with this in it :

```
#!/bin/bash

if [ "$PRODUCT" = "4cb/100/1000" ]; then

        mount /dev/sda1 -t vfat -o umask=000 /mnt/fuji

        echo "#!/bin/bash" > $REMOVER

        echo "umount /mnt/fuji" >> $REMOVER

        chmod a+x $REMOVER

fi

```

Then chmod a+x /etc/hotplug/usb/usb-storage and that's all !

This file is called just after the module usb-storage is loaded, it mounts the camera file system then fills another file which will be called when the camera is disconnected and will unmount the camera.

If you want to modify this script, check /etc/hotplug/usb.agent to see what information is available (like $PRODUCT, $REMOVER, ...) to the script.

The product number in this script is the one of the Fujifilm FinePix 1400Zoom and it works perfectly with my Fujifilm FinePix 6800Zoom. It's magic.

Hope it helps,

Yannick

PS : To find your product number ($PRODUCT), you may first put this in /etc/hotplug/usb/usb-storage :

```
#!/bin/bash

echo $PRODUCT > ~/PRODUCT

```

Then plug your device, and replace, in the first script, "4cb/100/1000" by the content of ~/PRODUCT.

PS : The test on the product number is only necessary if you possess more than one usb-storage device.

----------

## ozric100

I used this for my PQI... thanks

----------

## sklettke

This is an old thread, so I may have to repost this anew, but from the linux-usb website I found that this 0x0451:0x5409 was the ID for my nex ii player.  How do I change that to a format that fits in the hotplug script?  Also, that script that is supposed to find the product number for me has never worked.  Anyone experience this too?

I can access the nex ii fine by doing a "mount /mnt/nexii", but none of this hotplug stuff is working.

Scott

----------

