diff options
author | Fritz Elfert <felfert@to.com> | 2001-02-06 01:01:46 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2001-02-06 01:01:46 +0000 |
commit | a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e (patch) | |
tree | 0dd290cdf04cfd17a4ab4d0eb86bcb48137a02cb /lib/rfsv16.cc | |
parent | a8787d39b2bf1851cdea64a5e0eccc2aff7f15de (diff) | |
download | plptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.tar.gz plptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.tar.bz2 plptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.zip |
- Added KDE2 PropsDialog Plugin (incomplete)
- Fixed some KDE related autoconf stuff
- Added PlpDrive class for returning results from rfsv:devinfo
- Added auto-watch in ppsocket and finally got rid of the nasty
SIGPIPE bug. Now it's no more necessary to ignore SIGPIPE in
applications.
- Made constructors of rfsv16, rfsv32, rpcs16 and rpcs32 private to
enforce use of the factories.
- Removed error output in the factories and replaced that by error codes
which can be retrieved and evaluated by an application.
Diffstat (limited to 'lib/rfsv16.cc')
-rw-r--r-- | lib/rfsv16.cc | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/lib/rfsv16.cc b/lib/rfsv16.cc index 2b474cb..f98816c 100644 --- a/lib/rfsv16.cc +++ b/lib/rfsv16.cc @@ -413,8 +413,18 @@ devlist(u_int32_t &devbits) return res; } +static int sibo_dattr[] = { + 1, // Unknown + 2, // Floppy + 3, // Disk + 6, // Flash + 5, // RAM + 7, // ROM + 7, // write-protected == ROM ? +}; + Enum<rfsv::errs> rfsv16:: -devinfo(const u_int32_t devnum, u_int32_t &free, u_int32_t &size, u_int32_t &attr, u_int32_t &uniqueid, string &name) +devinfo(const u_int32_t devnum, PlpDrive &drive) { bufferStore a; Enum<rfsv::errs> res; @@ -448,16 +458,31 @@ devinfo(const u_int32_t devnum, u_int32_t &free, u_int32_t &size, u_int32_t &att // cerr << "devinfo STATUSDEVICE res is " << dec << (signed short int) res << endl; return res; } + + int attr = a.getWord(2); + attr = sibo_dattr[a.getWord(2) & 0xff]; + drive.setMediaType(attr); + attr = a.getWord(2); - // int changeable = a.getWord(4); - size = a.getDWord(6); - free = a.getDWord(10); - // const char *volume = a.getString(14); - // int battery = a.getWord(30); - // const char *devicename = a.getString(62); - uniqueid = 0; - name = ""; - name += (char)(devnum + 'A'); + int changeable = a.getWord(4) ? 32 : 0; + int internal = (attr & 0x2000) ? 16 : 0; + + drive.setDriveAttribute(changeable | internal); + + int variable = (attr & 0x4000) ? 1 : 0; + int dualdens = (attr & 0x1000) ? 2 : 0; + int formattable = (attr & 0x0800) ? 4 : 0; + int protect = ((attr & 0xff) == 6) ? 8 : 0; + + drive.setMediaAttribute(variable|dualdens|formattable|protect); + + drive.setUID(0); + drive.setSize(a.getDWord(6), 0); + drive.setSpace(a.getDWord(10), 0); + + drive.setName('A' + devnum, a.getString(14)); + + return res; } |