Page 1 of 1
[Embedded] Strategy for reducing the size of the database?
Posted: 16 Jul 2012, 12:44
by tirant
The included database of devices is almost 1MiB in size when uncompressed. For those of you working on embedded devices what kind of strategy are you following to store that information in your device? 1MiB can be a lot for some kind of devices.
Do you know of a way to make usb_modeswitch to work directly with configPack.tar.gz?
My alternative is to untar/gunzip the config file at boot time and store in a ramfs... or when an usb connection is detected, deploy the configuration on my ramfs and then once is applied, delete it. It will reduce response time in the system, but it's not a critical process.
Thanks!
Posted: 16 Jul 2012, 14:10
by Josh
I'm not sure what you mean with "database" ...
The unpacked directory with config files has 36.832 bytes (latest version). The rules file has 26.132 bytes and will only be needed for udev integration. That's a lot less than 1.000.000 bytes.
???
BTW, the wrapper script works with the packed file directly. For a file listing, it uses "tar -tzf <pack>", for extracting contents of a single file it uses "tar -xzOf <pack> <config_file_name>".
Also, you can achieve an even smaller config file collection by removing the single line comment in each of the files and even the blank lines.
Posted: 17 Jul 2012, 11:53
by tirant
Hi Josh,
I'm sorry if I didn't explain myself better...
When I am talking about the database, Im talking about the configPack.tar.gz file and its included files (after all a database is just a collection of data in an organized form

).
In its original form, its size is:
But when uncompressed it can be around 900K. Of course, it depends on the sector size of the used file system. If you don't take that into account, the uncompressed information is exactly 54.2K.
I am not using the wrapper script, just the static binary... It's for a really small and limited embedded system.
Posted: 17 Jul 2012, 18:59
by Josh
O.K., I see.
But again, it is possible to use the packed configuration
without actually extracting files.
You could do it with a little shell script. If you feed the extracted config file
content through a variable to the usb_modeswitch binary with the "-f" parameter, you should be able to skip extracting files alltogether.
Here are the simplified code snippets from the wrapper script (Tcl syntax):
Code: Select all
set configFileList [exec tar -tzf <path-to>/configPack.tar.gz]
... <determine which file to use, store name in "configFile"> ...
set configBuffer [exec tar -xzOf <path-to>/configPack.tar.gz $configFile]
usb_modeswitch -I -v $usb(idVendor) -p $usb(idProduct) -f "$configBuffer"
Posted: 18 Jul 2012, 09:47
by tirant
Yes, that's another option, thanks

We just have to evaluate what kind of performance would that offer to us. And of course change it to bash, as we dont have any TCL
Thanks again Josh! It's really nice to have someone to support his project so much and so well!!