Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
tirant
Posts: 7
Joined: 13 Jul 2012, 13:52

[Embedded] Strategy for reducing the size of the database?

Post by tirant » 16 Jul 2012, 12:44

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!

Josh
Site Admin
Posts: 6593
Joined: 03 Nov 2007, 00:30

Post by Josh » 16 Jul 2012, 14:10

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.


tirant
Posts: 7
Joined: 13 Jul 2012, 13:52

Post by tirant » 17 Jul 2012, 11:53

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:

Code: Select all

12K	configPack.tar.gz
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.

Josh
Site Admin
Posts: 6593
Joined: 03 Nov 2007, 00:30

Post by Josh » 17 Jul 2012, 18:59

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"

tirant
Posts: 7
Joined: 13 Jul 2012, 13:52

Post by tirant » 18 Jul 2012, 09:47

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!!

Post Reply