From a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Tue, 6 Feb 2001 01:01:46 +0000 Subject: - 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. --- lib/rfsv16.cc | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'lib/rfsv16.cc') 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 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 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; } -- cgit v1.2.3