User:Helmar Wodtke

From A110 Wiki
Jump to: navigation, search

Contents

What I tried as of now:

  • Booting Sidux from USB-stick: works, the d-u broke the installation from last year (not a fault of A110).
  • Booting Sidux CD from external USB drive: works. Assumed to not working correctly: card reader, resolution 800x480, modem. The ndiswrapper driver have to be the one from Win98 - 2000 will not work.
  • Installing the drivers from http://service.one.de/download/index.php?&direction=0&order=&directory=NOTEBOOKS/ONE_A1xx/Linux%20Drivers/Binary-driver/VGA with Sidux CD. Without the correct xorg.conf it looks like hurting the machine. Well, I tried it without the correct configuration first - it gave a strange result (starting with something dark and getting brighter and brighter...)
  • Installed Sidux with drivers and kernel from One - Sidux Installation

Observations

  • It seems to be possible to install a 1.8" HD. I did not open the machine but did a close look thrue the opening in case. It's told it's impossible.

Fun

A110-helmar.jpg

A110visor.jpg

A110vsPCUM10.jpg

Well, last one is only 200g more than the A110. It's rare today. It's not much thicker than what Apple ships at the moment (I think it's less than 1mm the Apple could win, maybe the Apple would have had lost against it with it's Airbook - but nobody remembers this PC). It's the PC UM-10 from Sharp. The keyboard has a special: the keys raise if you open the case. But everything is very solid. My machine still works, but the display has a damage since the thing was falling down from about 2m. You see the best ultra mobile device I ever had ;)

misc

A script to change xorg.conf:

#! /bin/sh
cd /etc/X11
ch=`ls xorg.conf*`
chx=`perl -e '$a.="$_ $ARGV[$_] " for 0..$#ARGV; print $a' $ch`
chu=`dialog --timeout 10 --stdout --menu "select xorg.conf" 20 60 10 $chx`
if [ "$chu" != "" ] ; then
  chf=`perl -e 'print $ARGV[$ARGV[0] + 1]' $chu $ch`
  if [ $chf != xorg.conf ] ; then
    mv -f xorg.conf ~xorg.conf
    ln -sf $chf xorg.conf
  fi
fi

exdfs

Next is a script to mount FAT32 file systems or similar. It supports

  • chmod & mkfifo
  • symlinks
  • mixed case file names like "Aaa" beside "aAa"
 Usage: perl exdfs.pl /your/basedir /your/mountpoint

Attention: this does not fork(), so be sure to have another terminal open.

You can umount the things

 fusermount -u /your/mountpoint

Beside the discussion, if something like this makes really sense, I use it to utilize my MP3-player a little better. I can not do partitioning there and it wants FAT32.

Everything is very early beta! Testers are welcome.

 #! /usr/bin/perl -w
 # filename: exdfs.pl
 # exdfs - EXD File System
 #
 # Author: Helmar Wodtke, 2008
 #
 # License: Public Domain
 #          or the closest thing your copyright law has to offer.
 #
 # THIS SOFTWARE COMES WITHOUT ANY WARRANTY. THE AUTHOR CAN NOT EVEN
 # REMEMBER WHAT THIS SOFTWARE WAS INTENDED TO DO ORIGINALLY.
 #
 # Note: The source is based on the examples for libfuse-perl.
 #
 use strict;
 #
 use Fuse;
 use IO::File;
 use IO::Handle;
 use POSIX qw(ENOENT ENOSYS EEXIST EPERM O_RDONLY O_RDWR O_APPEND O_CREAT);
 use Fcntl qw(S_ISBLK S_ISCHR S_ISFIFO S_IFLNK SEEK_SET);
 #
 my $chars = "-A-Za-z0-9#";
 my $log = "exdfs.log";
 my $lof = "exdfs.lof";
 my $defmod = 0644;
 #
 @ARGV or die "usage: $0 basedir mountpoint\n";
 my $tmp_path = shift;
 -d $tmp_path or die "no directory to mount\n";
 # -------------------------------------------------------------------
 my %renamed = ("" => "", "/" => "");
 my (%reversen, %fatuniq, %mod, %sym);
 my %hidden = (
   "/$log" => 1,
   "/$lof" => 1,
 );
 sub fn_encode {
   my $fn = shift;
   $fn =~ s/([\r\n\t %])/sprintf("%%%02x", ord($1))/ge;
   return $fn;
 }
 sub fn_decode {
   my $fn = shift;
   $fn =~ s/%(..)/pack("H*", $1)/ge;
   return $fn;
 }
 sub setname {
   my ($f, $nf) = @_;
   $renamed{$f} = $nf;
   $reversen{$nf} = $f;
   return $nf;
 }
 sub cleanup {
   my $fn = shift;
   my $rn = $renamed{$fn};
   defined $rn && undef $reversen{$rn};
   undef $renamed{$fn};
   undef $mod{$fn};
   undef $sym{$fn};
   return 0;
 }
 sub logl {
   LOG->opened || return;
   my $out = join(' ', @_)."\n";
   print LOG $out;
   LOG->autoflush();
   return;
 }
 sub log_cleanup {
   my $fn = shift;
   if (   defined $renamed{$fn}
       || defined $mod{$fn}
       || defined $sym{$fn}) {
     cleanup $fn;
     logl("rm", fn_encode($fn));
   }
   return 0;
 }
 sub readlog {
   my $lf = shift;
   open RLOG, "<$lf" or return;
   my $ip = my $op = "";
   while (<RLOG>) {
     /^fn (\S+) (\S+)$/ && setname(fn_decode($1), $2);
     /^cm (\S+) (\S+)$/ && ( $mod{$1} = $2 + 0 );
     /^sy (\S+) (\S+)$/ && ( $sym{fn_decode($1)} = fn_decode($2) );
     /^rm (\S+)/        && cleanup(fn_decode($1));
     if (/^dp (\S+) (\S+)$/) {
       ($ip, $op) = (fn_decode($1), $2);
       $ip = "" if $ip eq "%";
       $op = $ip if $op eq "%";
       setname($ip, $op);
     }
     if (/^fi (\S+) (\S+) (\S+) (\S+)$/) {
       my ($fn, $new, $mod, $sym) =
          ("$ip/".fn_decode($1), $2, $3, fn_decode($4));
       setname($fn, "$op/$new") if $new ne "%";
       $mod{$fn} = $mod + 0     if $mod ne "%";
       $sym{$fn} = $sym         if $sym ne "%";
     }
   }
   close RLOG;
 }
 sub fixup;
 sub numslash {
   my @slashes = (shift =~ m:/:g);
   return scalar @slashes;
 }
 sub writelog {
   my $fn = shift;
   open WLOG, ">$fn" or return 0;
   my %done = ("" => 1, "/" => 1);
   my $dn = "///"; # force to setup
   for (sort { numslash($a) <=> numslash($b) || $a cmp $b }
             (keys %renamed, keys %mod, keys %sym)) {
     next if defined $done{$_};
     $done{$_} = 1;
     next if !-e fixup($_);
     my $ldn = dirname($_);
     my $fn = basename($_);
     my $new = basename(fix_fn($_));
     $new = "%" if $fn eq $new;
     my $mod = defined $mod{$_} ? $mod{$_} : "%";
     my $sym = defined $sym{$_} ? $sym{$_} : "%";
     next if "$new$mod$sym" eq "%%%";
     if ($ldn ne $dn) {
       my $n = fix_fn($ldn);
       print WLOG "dp ".($ldn eq	 "" ? "%" : fn_encode($ldn))
                  ." ".($n eq $ldn ? "%" : $n)."\n";
       $dn = $ldn;
     }
     print WLOG "fi ".fn_encode($fn)." $new $mod $sym\n";
   }
   close WLOG;
   return 1;  
 }
 sub logrotate {
   my $keep_open = shift;
   close LOG;
   writelog "$tmp_path/$lof";
   rename "$tmp_path/$lof", "$tmp_path/$log";
   $keep_open and (open LOG, ">>$tmp_path/$log" or die "filesystem on fire");
   return;
 }
 sub basename {
   my $fn = shift;
   $fn =~ /([^\/]+)$/ || return ".";
   return $1;
 }
 sub dirname {
   my $fn = shift;
   $fn =~ s|/[^/]+$|| || return "";
   return $fn;
 }
 sub indir {
   my ($dir, $fn) = @_;
   opendir(DIRH, $dir) or return 0;
   my @dir = readdir(DIRH);
   closedir(DIRH);
   for (@dir) {
     return 1 if $fn eq $_;
   }
   return 0;
 }
 sub creatf {
   my $fn = shift;
   open TMP, ">$fn" or return $!;
   close TMP;
   return 0;
 }
 sub alternate_fn {
   my $fn = shift;
   my $ext = "";
   $fn =~ s:([.][^./][^./]?[^./]?)$:: and $ext = $1;
   while (1) {
     for (0..999) {
       my $tf = $fn . sprintf("%03d", $_) . $ext;
       return $tf if ! -e "$tmp_path$tf";
     }
     $ext = "_$ext";
   }
 }
 sub fix_fn;
 sub fix_fn {
   my $fn = shift;
   defined $renamed{$fn} && return $renamed{$fn};
   my $nd = fix_fn(dirname($fn));
   my $nf = basename($fn);
   unless ( -e "$tmp_path$nd/$nf"
        && indir("$tmp_path$nd", $nf)) {
     $nf =~ s:[^$chars.]:_:go;
     $nf =~ /^[^.]{1,8}([.][^.]{1,3})?$/
       and $nf = lc($nf);
   }
   my $new = "$nd/$nf";
   if (  defined $reversen{$new}
      || (-e "$tmp_path$new"
         && ! indir("$tmp_path$nd", $nf))
      ) {
     $new = alternate_fn($new);
   }
   logl("fn", fn_encode($fn), $new)
     if basename($fn) ne basename($new);
   return setname($fn, $new);
 }
 sub fixup {
   return $tmp_path . fix_fn(@_);
 }
 # -------------------------------------------------------------------
 sub x_getattr {
   my $file = fixup(my $fno = shift);
   my @list = lstat($file);
   return -$! unless @list;
   $list[2] = $mod{$fno} if defined $mod{$fno};
   return @list;
 }
 sub x_getdir {
   my $odir = shift;
   my $dirname = fixup($odir);
   unless(opendir(DIRHANDLE,$dirname)) {
     return -ENOENT();
   }
   my @files = readdir(DIRHANDLE);
   closedir(DIRHANDLE);
   my $fdir = fix_fn($odir);
   $odir .= "/" if $odir !~ /\/$/;
   $fdir .= "/" if $fdir !~ /\/$/;
   my @out;
   for (@files) {
     next if defined $hidden{"$odir$_"};
     if (defined $reversen{"$fdir$_"}) {
       push @out, basename($reversen{"$fdir$_"});
       next;
     }
     push @out, $_;
   }
   return (@out, 0);
 }
 sub x_open {
   my $file = fixup(shift);
   my $mode = shift;
   return -$! unless sysopen(FILE,$file,$mode);
   close(FILE);
   return 0;
 }
 sub x_read {
   my ($file,$bufsize,$off) = @_;
   my $rv = -ENOSYS();
   my $handle = new IO::File;
   return -ENOENT() unless -e ($file = fixup($file));
   my $fsize = -s $file;
   return -ENOSYS() unless open($handle,$file);
   if(seek($handle,$off,SEEK_SET)) {
     read($handle,$rv,$bufsize);
   }
   return $rv;
 }
 sub x_write {
   my ($file,$buf,$off) = @_;
   my $rv;
   return -ENOENT() unless -e ($file = fixup($file));
   my $fsize = -s $file;
   return -ENOSYS() unless open(FILE,'+<',$file);
   $rv = print(FILE $buf) if ($rv = seek(FILE,$off,SEEK_SET));
   $rv = -ENOSYS() unless $rv;
   close(FILE);
   return length($buf);
 }
 sub x_readlink {
   my $fn = shift;
   return (defined $sym{$fn} ? $sym{$fn} : -1);
 }
 sub x_unlink   {
   my $fn = shift;
   unlink(fixup($fn)) && return log_cleanup($fn);
   return -$!;
 }
 sub x_link {
   return link(fixup(shift),fixup(shift)) ? 0 : -$!;
 }
 sub x_chmod {
   my $fno = shift;
   my $fn = fixup($fno);
   my $mode = shift;
   if (-e $fn) {
     if ((!defined $mod{$fno}) || $mod{$fno} !=  $mode) {
       $mod{$fno} = $mode;
       logl("cm", fn_encode($fno), $mode);
     }
     return 0;
   }
   return -EEXIST();
 }
 sub x_truncate {
   return truncate(fixup(shift),shift) ? 0 : -$!;
 }
 sub x_utime {
   return utime($_[1],$_[2],fixup($_[0])) ? 0 : -$!;
 }
 sub x_mkdir {
   my ($name, $perm) = @_;
   return mkdir(fixup($name),$perm) ? 0 : -$!;
 }
 sub x_rmdir {
   my $fn = shift;
   rmdir(fixup($fn)) and return log_cleanup($fn);
   return -$!;
 }
 sub x_mknod {
   my ($fno, $modes, $dev) = @_;
   return -creatf(fixup $fno) || x_chmod($fno, $modes);
 }
 sub x_symlink {
   my $f1 = shift;
   my $fx2 = shift;
   my $f2 = fixup($fx2);
   my $ret = creatf($f2);
   $ret && return -$ret;
   ($ret = x_chmod($fx2, (stat($f2))[2] | S_IFLNK()))
     and return -$ret;
   if ((!defined $sym{$fx2}) || $sym{$fx2} ne $f1) {
     $sym{$fx2} = $f1;
     logl("sy", fn_encode($fx2), fn_encode($f1));
   }
   return 0;
 }
 sub x_rename {
   my $old = fixup(my $fn1 = shift);
   my $new = fixup(my $fn2 = shift);
   my $err;
   unless ($err = rename($old,$new) ? 0 : -ENOENT()) {
     defined $mod{$fn1} and x_chmod($fn2, $mod{$fn1});
     defined $sym{$fn1} and x_symlink($sym{$fn1}, $fn2);
     log_cleanup $fn1;
   }
   return $err;
 }
 # kludge
 sub x_statfs {
   return 255,1000000,500000,1000000,500000,4096
 }
 # ---------------------------------------------------
 readlog "$tmp_path/$log";
 open LOG, ">>$tmp_path/$log" or die "could not open log!\n";
 my $mountpoint = "";
 $mountpoint = shift if @ARGV;
 #
 Fuse::main(
   mountpoint=>$mountpoint,
   getattr =>"main::x_getattr",   readlink=>"main::x_readlink",
   getdir  =>"main::x_getdir",    mkdir   =>"main::x_mkdir",
   unlink  =>"main::x_unlink",    rmdir   =>"main::x_rmdir",
   symlink =>"main::x_symlink",   rename  =>"main::x_rename",
   link    =>"main::x_link",      chmod   =>"main::x_chmod",
   truncate=>"main::x_truncate",  utime   =>"main::x_utime",
   open    =>"main::x_open",      read    =>"main::x_read",
   write   =>"main::x_write",     statfs  =>"main::x_statfs",
   mknod   =>"main::x_mknod",     threaded=>0,
 #  debug => 1,
 );
 logrotate 0;
Personal tools