It is currently Wed Jul 08, 2020 2:34 pm

Post new topic Reply to topic  [ 2 posts ] 
Running it on Linux 
Author Message

Joined: Tue Apr 22, 2008 5:05 am
Posts: 1
Location: Germany
Post Running it on Linux
As I only run Linux on my computer, I had to do some manual work to get it running.

At first I wrote a little tool, to convert tiff images to the art.lebedev format of these sys-files. Here's the source. You'll need libtiff and libtiff-dev to compile and run it. argv[1] is the input file (must be tiff, 48x48), argv[2] is the resulting sys-file.
#include <tiffio.h>

int main(int argc, char* argv[]) {
        TIFF* bild;

        uint32 raster[48*48];
        uint16 res[48*48];

        bild = TIFFOpen(argv[1], "r");
        TIFFReadRGBAImage(bild, 48, 48, raster, 0);

        for (int y = 0; y < 48; y++) {
                for (int x = 0; x < 48; x++) {
                        res[x+48*y] = ((TIFFGetR(raster[x+48*y]) & 0xF8) | (TIFFGetG(raster[x+48*y]) >> 5)) | (((TIFFGetB(raster[x+48*y]) >> 3) | ((TIFFGetG(raster[x+48*y]) >> 2) & 0x07)) << 8);

        FILE* f;
        f = fopen(argv[2], "w");
        for (int y = 47; y >= 0; y--) {
                for (int x = 0; x < 48; x++) {
                        fwrite(&(res[x+48*y]), sizeof(uint16), 1, f);
        return 0;

I didn't do much testing or error handling, but it basically works for me. Will probably update it soon.

Now you can create your key-images with your favourite image manipulation application.
To activate them, I just wrote some little shell scripts, that look like this:

./tiff2sys/tiff2sys keys/normal_q.tiff /media/VirtualDisk/vOptimus/normal/086.sys
./tiff2sys/tiff2sys keys/normal_w.tiff /media/VirtualDisk/vOptimus/normal/075.sys
./tiff2sys/tiff2sys keys/normal_e.tiff /media/VirtualDisk/vOptimus/normal/069.sys
./tiff2sys/tiff2sys keys/normal_r.tiff /media/VirtualDisk/vOptimus/normal/070.sys
./tiff2sys/tiff2sys keys/normal_t.tiff /media/VirtualDisk/vOptimus/normal/059.sys
./tiff2sys/tiff2sys keys/normal_y.tiff /media/VirtualDisk/vOptimus/normal/060.sys
./tiff2sys/tiff2sys keys/normal_u.tiff /media/VirtualDisk/vOptimus/normal/054.sys
./tiff2sys/tiff2sys keys/normal_I.tiff /media/VirtualDisk/vOptimus/normal/053.sys
./tiff2sys/tiff2sys keys/normal_o.tiff /media/VirtualDisk/vOptimus/normal/043.sys
./tiff2sys/tiff2sys keys/normal_p.tiff /media/VirtualDisk/vOptimus/normal/044.sys
./tiff2sys/tiff2sys keys/normal_a.tiff /media/VirtualDisk/vOptimus/normal/083.sys
./tiff2sys/tiff2sys keys/normal_s.tiff /media/VirtualDisk/vOptimus/normal/076.sys
./tiff2sys/tiff2sys keys/normal_d.tiff /media/VirtualDisk/vOptimus/normal/068.sys
./tiff2sys/tiff2sys keys/normal_f.tiff /media/VirtualDisk/vOptimus/normal/067.sys
./tiff2sys/tiff2sys keys/normal_g.tiff /media/VirtualDisk/vOptimus/normal/062.sys
./tiff2sys/tiff2sys keys/normal_h.tiff /media/VirtualDisk/vOptimus/normal/061.sys
./tiff2sys/tiff2sys keys/normal_j.tiff /media/VirtualDisk/vOptimus/normal/051.sys
./tiff2sys/tiff2sys keys/normal_k.tiff /media/VirtualDisk/vOptimus/normal/052.sys
./tiff2sys/tiff2sys keys/normal_I.tiff /media/VirtualDisk/vOptimus/normal/046.sys
./tiff2sys/tiff2sys keys/normal_z.tiff /media/VirtualDisk/vOptimus/normal/077.sys
./tiff2sys/tiff2sys keys/normal_x.tiff /media/VirtualDisk/vOptimus/normal/066.sys
./tiff2sys/tiff2sys keys/normal_c.tiff /media/VirtualDisk/vOptimus/normal/065.sys
./tiff2sys/tiff2sys keys/normal_v.tiff /media/VirtualDisk/vOptimus/normal/063.sys
./tiff2sys/tiff2sys keys/normal_b.tiff /media/VirtualDisk/vOptimus/normal/064.sys
./tiff2sys/tiff2sys keys/normal_n.tiff /media/VirtualDisk/vOptimus/normal/050.sys
./tiff2sys/tiff2sys keys/normal_m.tiff /media/VirtualDisk/vOptimus/normal/049.sys


The sync at the end is important to commit the changes. Otherwise they will be kept in the fs-cache and it will take a while until the changes take effect.

To generate text on the fly, you can use imagemagick:
convert -size 48x48 xc:black -font Verdana-Bold -pointsize 16 -fill white -draw "text -1,32 'wtf?'" /tmp/esc.tiff
This will generate a little tiff file containing the text 'wtf?'. Now copy it into your keyboard:
./tiff2sys/tiff2sys /tmp/esc.tiff /media/VirtualDisk/vOptimus/normal/099.sys
Check the docs of imagemagick for adding more cool effects.

Some cool dynamic stuff:
convert -size 48x48 xc:black -font Verdana-Bold -pointsize 16 -fill white -draw "text -1,32 '`date +%H:%M`'" time.tiff
./tiff2sys/tiff2sys ~/time.tiff /media/keyboard/vOptimus/normal/078.sys

This will put the current time into your spacebar. I'm using cron, to update it every minute.

Any more Linux users out there? Let me know, how you handle your Optimus.
Questions or problems with my scripts? Feel free to ask.

Tue Apr 22, 2008 5:27 am
Site Admin
User avatar

Joined: Tue Feb 26, 2008 8:53 pm
Posts: 49
Location: Sydney AU
Post Re: Running it on Linux
Excellent work MrTweek!

Tue Apr 22, 2008 9:41 am
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forum/DivisionCore.