Re: usb mass media storage

2008-09-07 Thread Marco Trevisan (Treviño)
[EMAIL PROTECTED] wrote:
 The host has direct access to the block device, so it is important
 that /dev/mmcblk0p1 is not mounted on both the phone and the host at
 the same time (unless it's mounted ro on both).
 
 What if it was mounted ro on the phone side and rw on the host side? Would 
 that cause problems?

It shouldn't, but I'd like to get a confirmation too :P

Btw I think that the safer way is that of using a memory-stick file 
saved in SD as explained by Christian Adams...

-- 
Treviño's World - Life and Linux
http://www.3v1n0.net/


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-05 Thread Dale Maggee
Petr Vanek wrote:
 I have spent a while googling this up and have no wiki skills but
 someone might find this useful:

 to make FR act as a memory stick, here is what my script does:


 #!/bin/sh 
   
 
 /etc/init.d/networking stop
 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1

 --
 Petr Vaněk
 http://biodynamika.cz
   

very cool, but before I test it out (potentially breaking my usb 
networking in the process), I have a couple of questions:

1. will this persist over a reboot, or will it revert back to being an 
ethernet gadget when I reboot?

2. is the following sufficient to switch it back?

#!/bin/sh
rmmod g_file_storage
modprobe g_ether
ifup usb0

(assuming I replaced '/etc/init.d/networking stop' with 'ifdown usb0' as 
recommended by Daniel)

3. can somebody point me to a resource for the g_file_storage module 
where I can learn more about it? I did a couple of quick googles but 
didn't see anything promising. specifically I'd like to know more about 
the file parameter - I assume that in this scenario our usb stick is 
using partition/device information from /dev/mmcblk0p1, and will be 
partitioned in the same way as the SD card? what If I wanted to have my 
home directory accessible in usb stick mode?

Thanks,
-Dale



___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-05 Thread Fox Mulder
1. This only works until reboot or manually reverting it.

2. Don't know, maybe. :)

3. /dev/mmcblk0p1 is the first partition on the sd card. So the usb
stick will only show this one partition and nothing more.

Ciao,
 Rainer

Dale Maggee wrote:
 Petr Vanek wrote:
 I have spent a while googling this up and have no wiki skills but
 someone might find this useful:

 to make FR act as a memory stick, here is what my script does:


 #!/bin/sh
  
   
 /etc/init.d/networking stop
 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1

 --
 Petr Vaněk
 http://biodynamika.cz
   
 
 very cool, but before I test it out (potentially breaking my usb 
 networking in the process), I have a couple of questions:
 
 1. will this persist over a reboot, or will it revert back to being an 
 ethernet gadget when I reboot?
 
 2. is the following sufficient to switch it back?
 
 #!/bin/sh
 rmmod g_file_storage
 modprobe g_ether
 ifup usb0
 
 (assuming I replaced '/etc/init.d/networking stop' with 'ifdown usb0' as 
 recommended by Daniel)
 
 3. can somebody point me to a resource for the g_file_storage module 
 where I can learn more about it? I did a couple of quick googles but 
 didn't see anything promising. specifically I'd like to know more about 
 the file parameter - I assume that in this scenario our usb stick is 
 using partition/device information from /dev/mmcblk0p1, and will be 
 partitioned in the same way as the SD card? what If I wanted to have my 
 home directory accessible in usb stick mode?
 
 Thanks,
 -Dale
 
 
 
 ___
 Openmoko community mailing list
 community@lists.openmoko.org
 http://lists.openmoko.org/mailman/listinfo/community

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-05 Thread Dale Maggee
Petr Vanek wrote:
 I have spent a while googling this up and have no wiki skills but
 someone might find this useful:

 to make FR act as a memory stick, here is what my script does:


 #!/bin/sh 
   
 
 /etc/init.d/networking stop
 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1

 --
 Petr Vaněk
 http://biodynamika.cz
   
very cool, but before I test it out (potentially breaking my usb 
networking in the process), I have a couple of questions:

1. will this persist over a reboot, or will it revert back to being an 
ethernet gadget when I reboot?

2. is the following sufficient to switch it back?

#!/bin/sh
rmmod g_file_storage
modprobe g_ether
ifup usb0

(assuming I replaced '/etc/init.d/networking stop' with 'ifdown usb0' as 
recommended by Daniel)

3. can somebody point me to a resource for the g_file_storage module 
where I can learn more about it? I did a couple of quick googles but 
didn't see anything promising. specifically I'd like to know more about 
the file parameter - I assume that in this scenario our usb stick is 
using partition/device information from /dev/mmcblk0p1, and will be 
partitioned in the same way as the SD card? what If I wanted to have my 
home directory accessible in usb stick mode?

Thanks,
-Dale

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-05 Thread Christian Adams
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

moinmoin

there is no must for using /dev/mmc* .. you could also use a plain  
file:

preparations:

create mem_stick.fs file
dd if=/dev/zero of=mem_stick.fs bs=512 count=1048576 # for a 512mb  
memory-stick with blocksize=512 bytes

create filesystem on mem_stick.fs:
mkfs.ext3 mem_stick.fs

from FR you can mount this filesystem with:
mount -o loop mem_stick.fs some_mount_point

and for exporting via usb:

rmmod g_ether
# if mount - umount!
modprobe g_file_storage file=mem_stick.fs

regards, morlac


Am 05.09.2008 um 13:04 schrieb pHilipp Zabel:

 On Fri, Sep 5, 2008 at 4:41 AM, Dale Maggee  
 [EMAIL PROTECTED] wrote:
 Petr Vanek wrote:
 I have spent a while googling this up and have no wiki skills but
 someone might find this useful:

 to make FR act as a memory stick, here is what my script does:


 #!/bin/sh
 /etc/init.d/networking stop
 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1

 --
 Petr Vaněk
 http://biodynamika.cz

 very cool, but before I test it out (potentially breaking my usb
 networking in the process), I have a couple of questions:

 1. will this persist over a reboot, or will it revert back to  
 being an
 ethernet gadget when I reboot?

 It's not persistent unless you add something like this to the init
 scripts. After rebooting the ethernet gadget will be back.

 2. is the following sufficient to switch it back?

 #!/bin/sh
 rmmod g_file_storage
 modprobe g_ether
 ifup usb0

 (assuming I replaced '/etc/init.d/networking stop' with 'ifdown  
 usb0' as
 recommended by Daniel)

 3. can somebody point me to a resource for the g_file_storage module
 where I can learn more about it? I did a couple of quick googles but
 didn't see anything promising. specifically I'd like to know more  
 about
 the file parameter - I assume that in this scenario our usb  
 stick is
 using partition/device information from /dev/mmcblk0p1, and will be
 partitioned in the same way as the SD card? what If I wanted to  
 have my
 home directory accessible in usb stick mode?

 I suggest to read the comment in the source code, it's quite detailed:
 http://git.kernel.org/?p=linux/kernel/git/torvalds/ 
 linux-2.6.git;a=blob;f=drivers/usb/gadget/file_storage.c;hb=HEAD

 The file parameter determines the raw backing store for the storage
 device, so if you
 have file=/dev/mmcblk0p1, its contents will directly appear as
 /dev/sdx on the host. As mmcblk0p1 doesn't contain a partition table,
 so won't sdx. If you want to export the whole device, use
 file=/dev/mmcblk0, you'll get the partition table in /dev/sdx and the
 kernel will parse it and create /dev/sdx1 (containing the contents of
 /dev/mmcblk0p1) etc.

 The host has direct access to the block device, so it is important
 that /dev/mmcblk0p1 is not mounted on both the phone and the host at
 the same time (unless it's mounted ro on both).

 regards
 Philipp
 ___
 Openmoko community mailing list
 community@lists.openmoko.org
 http://lists.openmoko.org/mailman/listinfo/community


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFIwStgr81gVylJyzERAmHbAJwLiBalMaLkhe3p4//QQkgBs7PLfgCeOfMR
lsdWNYAG4g3mTT0Mo2KEyek=
=Vdg5
-END PGP SIGNATURE-

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-05 Thread Dale Maggee
Christian Adams wrote:
 moinmoin

 there is no must for using /dev/mmc* .. you could also use a plain  
 file:

 preparations:

 create mem_stick.fs file
 dd if=/dev/zero of=mem_stick.fs bs=512 count=1048576 # for a 512mb  
 memory-stick with blocksize=512 bytes

 create filesystem on mem_stick.fs:
 mkfs.ext3 mem_stick.fs

 from FR you can mount this filesystem with:
 mount -o loop mem_stick.fs some_mount_point

 and for exporting via usb:

 rmmod g_ether
 # if mount - umount!
 modprobe g_file_storage file=mem_stick.fs

 regards, morlac

   
 On Fri, Sep 5, 2008 at 4:41 AM, Dale Maggee  
 [EMAIL PROTECTED] wrote:
 
 Petr Vanek wrote:
   
 I have spent a while googling this up and have no wiki skills but
 someone might find this useful:

 to make FR act as a memory stick, here is what my script does:


 #!/bin/sh
 /etc/init.d/networking stop
 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1

 --
 Petr Vaněk
 http://biodynamika.cz

 
 very cool, but before I test it out (potentially breaking my usb
 networking in the process), I have a couple of questions:

 1. will this persist over a reboot, or will it revert back to  
 being an
 ethernet gadget when I reboot?
   
 It's not persistent unless you add something like this to the init
 scripts. After rebooting the ethernet gadget will be back.

 
 2. is the following sufficient to switch it back?

 #!/bin/sh
 rmmod g_file_storage
 modprobe g_ether
 ifup usb0

 (assuming I replaced '/etc/init.d/networking stop' with 'ifdown  
 usb0' as
 recommended by Daniel)

 3. can somebody point me to a resource for the g_file_storage module
 where I can learn more about it? I did a couple of quick googles but
 didn't see anything promising. specifically I'd like to know more  
 about
 the file parameter - I assume that in this scenario our usb  
 stick is
 using partition/device information from /dev/mmcblk0p1, and will be
 partitioned in the same way as the SD card? what If I wanted to  
 have my
 home directory accessible in usb stick mode?
   
 I suggest to read the comment in the source code, it's quite detailed:
 http://git.kernel.org/?p=linux/kernel/git/torvalds/ 
 linux-2.6.git;a=blob;f=drivers/usb/gadget/file_storage.c;hb=HEAD

 The file parameter determines the raw backing store for the storage
 device, so if you
 have file=/dev/mmcblk0p1, its contents will directly appear as
 /dev/sdx on the host. As mmcblk0p1 doesn't contain a partition table,
 so won't sdx. If you want to export the whole device, use
 file=/dev/mmcblk0, you'll get the partition table in /dev/sdx and the
 kernel will parse it and create /dev/sdx1 (containing the contents of
 /dev/mmcblk0p1) etc.

 The host has direct access to the block device, so it is important
 that /dev/mmcblk0p1 is not mounted on both the phone and the host at
 the same time (unless it's mounted ro on both).

 regards
 Philipp

 

   

Thanks for the info! very usefull indeed!

I made a script as follows (echo's are for debugging):

#!/bin/sh 
echo ifdown usb0...
ifdown usb0
echo rmmod g_ether...
rmmod g_ether
echo umount /media/card...
umount /media/card
echo modprobe g_file_storage file=/dev/mmcblk0p1...
modprobe g_file_storage file=/dev/mmcblk0p1

only problem is, when i run this in the 2007.2 terminal, it echoes 
'umount /media/card', and then totally freezes the freerunner! (to the 
point ofhaving to unplug the battery and reboot)

if i comment out the offending line in the script, then type 'umount 
/media/card', then run the script, it works fine...

thoughts?

Thanks,
-Dale

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-05 Thread arne anka
try to put your echo strings in quotes:

echo -n ifdown usb0...

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-05 Thread shawnzier
On Fri, Sep 05, 2008 at 01:04:52PM +0200, pHilipp Zabel wrote:
 On Fri, Sep 5, 2008 at 4:41 AM, Dale Maggee [EMAIL PROTECTED] wrote:
  Petr Vanek wrote:
  I have spent a while googling this up and have no wiki skills but
  someone might find this useful:
 
  to make FR act as a memory stick, here is what my script does:
 
 
  #!/bin/sh
  /etc/init.d/networking stop
  rmmod g_ether
  modprobe g_file_storage file=/dev/mmcblk0p1
 
  --
  Petr Vaněk
  http://biodynamika.cz
 
  very cool, but before I test it out (potentially breaking my usb
  networking in the process), I have a couple of questions:
 
  1. will this persist over a reboot, or will it revert back to being an
  ethernet gadget when I reboot?
 
 It's not persistent unless you add something like this to the init
 scripts. After rebooting the ethernet gadget will be back.
 
  2. is the following sufficient to switch it back?
 
  #!/bin/sh
  rmmod g_file_storage
  modprobe g_ether
  ifup usb0
 
  (assuming I replaced '/etc/init.d/networking stop' with 'ifdown usb0' as
  recommended by Daniel)
 
  3. can somebody point me to a resource for the g_file_storage module
  where I can learn more about it? I did a couple of quick googles but
  didn't see anything promising. specifically I'd like to know more about
  the file parameter - I assume that in this scenario our usb stick is
  using partition/device information from /dev/mmcblk0p1, and will be
  partitioned in the same way as the SD card? what If I wanted to have my
  home directory accessible in usb stick mode?
 
 I suggest to read the comment in the source code, it's quite detailed:
 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/usb/gadget/file_storage.c;hb=HEAD
 
 The file parameter determines the raw backing store for the storage
 device, so if you
 have file=/dev/mmcblk0p1, its contents will directly appear as
 /dev/sdx on the host. As mmcblk0p1 doesn't contain a partition table,
 so won't sdx. If you want to export the whole device, use
 file=/dev/mmcblk0, you'll get the partition table in /dev/sdx and the
 kernel will parse it and create /dev/sdx1 (containing the contents of
 /dev/mmcblk0p1) etc.
 
 The host has direct access to the block device, so it is important
 that /dev/mmcblk0p1 is not mounted on both the phone and the host at
 the same time (unless it's mounted ro on both).

What if it was mounted ro on the phone side and rw on the host side? Would that 
cause problems?


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-05 Thread Dale Maggee
arne anka wrote:
 try to put your echo strings in quotes:

 echo -n ifdown usb0...
   

did that, no luck. this time is froze after echoing ifdown usb0...


...?

-D

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-04 Thread Andy Green
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Somebody in the thread at some point said:

| Where did you get that kernel image? I haven't been able to find it
| anywhere. Is there any other way to get those commands?

Any recent kernel package should have these modules.

Word of warning though, USB Mass Storage is block based protocol, it
means that if you have the filesystem you are exposing there mounted on
Freerunner side as well, filesystem actions like update directories,
which blocks are free etc will conflict between the two mounts and less
than good experience will result :-O

So to play this game you need to ensure you umount the filesystem on the
shared storage from Freerunner first and I guess mount it back afterwards.

- -Andy
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkjAv4IACgkQOjLpvpq7dMr5pwCeLL1W9/6+cfj4+UyRdG7/XKrJ
ABgAn1Mog9TOlBDenPC8D5Dp6eXY+gQF
=ieRu
-END PGP SIGNATURE-

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-03 Thread Petr Vanek
On Wed, 3 Sep 2008 00:22:38 +0200
Adrien de Sentenac [EMAIL PROTECTED]
(ADS) wrote:

2008/9/2 Petr Vanek [EMAIL PROTECTED]

 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1


which kernel/distribution do you use ?
it seems I have neither of these modules with om2008.8 (with updates).


oh, sorry, i could have thought of this.. :) ASU

[EMAIL PROTECTED]:~# uname -a
Linux om-gta02 2.6.24 #1 PREEMPT Tue Aug 26 08:33:29 CST 2008 armv4tl
unknown

[EMAIL PROTECTED]:~# opkg list_installed | grep kernel | grep image
kernel-image-2.6.24 -
2:2.6.24+git75965+cb3cc53a76c7f1f7c827d048db7a849e77071515-r1.01 -


--
Petr Vaněk
http://biodynamika.cz




___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-02 Thread Daniel Benoy
You may want to use 'ifdown usb0' instead of '/etc/init.d/networking stop', in 
case you want to keep your wifi connection going.

That's cool though :)  I wonder if it's possible to pretend to be a USB hub, 
providing both g_ether and g_file_storage

On Tuesday 02 September 2008 15:47:18 Petr Vanek wrote:
 I have spent a while googling this up and have no wiki skills but
 someone might find this useful:
 
 to make FR act as a memory stick, here is what my script does:
 
 
 #!/bin/sh 
   
 
 /etc/init.d/networking stop
 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1
 
 --
 Petr Vaněk
 http://biodynamika.cz
 
 
 
 
 ___
 Openmoko community mailing list
 community@lists.openmoko.org
 http://lists.openmoko.org/mailman/listinfo/community
 



-- 
Daniel Benoy
http://daniel.benoy.name

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-02 Thread Al Johnson
On Tuesday 02 September 2008, Daniel Benoy wrote:
 You may want to use 'ifdown usb0' instead of '/etc/init.d/networking stop',
 in case you want to keep your wifi connection going.

 That's cool though :)  I wonder if it's possible to pretend to be a USB
 hub, providing both g_ether and g_file_storage

Not yet. At the moment it's one gadget driver at a time, but there is a 
project under way to allow use of multiple gadget drivers together. 

http://blog.felipebalbi.com/?p=44
http://www.linux-usb.org/gadget/

 On Tuesday 02 September 2008 15:47:18 Petr Vanek wrote:
  I have spent a while googling this up and have no wiki skills but
  someone might find this useful:
 
  to make FR act as a memory stick, here is what my script does:
 
 
  #!/bin/sh
  /etc/init.d/networking stop
  rmmod g_ether
  modprobe g_file_storage file=/dev/mmcblk0p1
 
  --
  Petr Vaněk
  http://biodynamika.cz

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-02 Thread Adrien de Sentenac
2008/9/2 Petr Vanek [EMAIL PROTECTED]

 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1


which kernel/distribution do you use ?
it seems I have neither of these modules with om2008.8 (with updates).
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: usb mass media storage

2008-09-02 Thread Marco Trevisan (Treviño)
Adrien de Sentenac wrote:
 2008/9/2 Petr Vanek [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED]
 
 rmmod g_ether
 modprobe g_file_storage file=/dev/mmcblk0p1
 
  
 which kernel/distribution do you use ?
 it seems I have neither of these modules with om2008.8 (with updates).

I figure that you need a kernel compiled with
  CONFIG_USB_STORAGE=m
  CONFIG_USB_ETH=m
isn't it?

-- 
Treviño's World - Life and Linux
http://www.3v1n0.net/


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community