This year i have been working quite a lot on Maemo platform to develop some GNOME applications into a cross-compile architecture. It’s being a very interesting experience, especially be part of GMAE and Maemo developer community and try to provide my experience in some projects.
This kind of development its oriented to mobile devices, which requires a different kind of applications and development strategy. As most of you know, mobile devices frequently needs some kind of external device to store data, cause internal memory is very expensive and therefore limited.
Scratchbox (www.scratchbox.org) its a cross-compiling environment to develop applications oriented to mobile devices. However, its very difficult int this environment to develop functionalities which requires access to this kind of external memory devices.
I found a simple way to emulate external memory devices using, for instance, a common usb key, to catch gnome-vfs events and handle them as it were emitted from an external memory card. From GNomeVFS point of view, these devices are managed in a similar way, so you cant test your uses cases in your PC.
- Install mount in sbox.
apt-get install mount
- Edit /etc/fstab file on sbox
none /proc proc defaults 0 0 /dev/sdb /media/memory vfat user,noauto 0 0
- From host, set ownerships and permissions to sbox mount and umount commands
chown root:root /scratchbox/users/jfernandez/targets/i386-2007-07-26/bin/mount chmod 4755 /scratchbox/users/jfernandez/targets/i386-2007-07-26/bin/mount chown root:root /scratchbox/users/jfernandez/targets/i386-2007-07-26/bin/umount chmod 4755 /scratchbox/users/jfernandez/targets/i386-2007-07-26/bin/umount
- Insert your USB key
- Mount your virtual file system
Now, gnome-vfs monitor could detect mount and umount events of your USB, emulating insertion of an external memory device.