diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-07-19 21:39:34 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-07-19 21:39:34 +0000 |
commit | 7888165dad1d6e8dd937a67d0eac461471002e6a (patch) | |
tree | 9a227e7ebf514b3f5f85ffd12b0290ae8b1aa589 /perl-install | |
parent | 66ff0e21bc1f61bd1968fb754a6930bce2f80a45 (diff) | |
download | drakx-7888165dad1d6e8dd937a67d0eac461471002e6a.tar drakx-7888165dad1d6e8dd937a67d0eac461471002e6a.tar.gz drakx-7888165dad1d6e8dd937a67d0eac461471002e6a.tar.bz2 drakx-7888165dad1d6e8dd937a67d0eac461471002e6a.tar.xz drakx-7888165dad1d6e8dd937a67d0eac461471002e6a.zip |
add functions to_devfs and from_devfs. These only work for devices entries
which can go devfs -> normal and normal -> devfs
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/devices.pm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/perl-install/devices.pm b/perl-install/devices.pm index 260793e30..8c45a41f7 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -182,4 +182,39 @@ sub make($) { $file; } + +#- only isomorphic entries are allowed, +#- i.e. entries which can go devfs -> normal and normal -> devfs +my %to_devfs = ( + psaux => 'misc/psaux', + usbmouse => 'input/mouse0', +); +my %to_devfs_prefix = ( + ttyS => 'tts/', +); + +sub to_devfs { + my ($dev) = @_; + if (my $r = $to_devfs{$dev}) { + return $r; + } elsif ($dev =~ /(.*?)(\d+)$/) { + my $r = $to_devfs_prefix{$1}; + return "$r$2" if $r; + } + undef; +} + +sub from_devfs { + my ($dev) = @_; + my %from_devfs = reverse %to_devfs; + if (my $r = $from_devfs{$dev}) { + return $r; + } elsif ($dev =~ /(.*?)(\d+)$/) { + my %from_devfs_prefix = reverse %to_devfs_prefix; + my $r = $from_devfs_prefix{$1}; + return "$r$2" if $r; + } + undef; +} + 1; |