aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rpcs32.cc
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2002-03-20 02:18:51 +0000
committerFritz Elfert <felfert@to.com>2002-03-20 02:18:51 +0000
commit1d9b2e0e156f9a58bd642b9f9e8b2a08e768f5ed (patch)
tree580f6fa06ce0d114f3861c709203af4c3d86237a /lib/rpcs32.cc
parentbedd0177bc1ec1bf3c425e034958209554c20171 (diff)
downloadplptools-1d9b2e0e156f9a58bd642b9f9e8b2a08e768f5ed.tar.gz
plptools-1d9b2e0e156f9a58bd642b9f9e8b2a08e768f5ed.tar.bz2
plptools-1d9b2e0e156f9a58bd642b9f9e8b2a08e768f5ed.zip
- rpcs: Implemented scratch RAM access.
- Updated spec file (not complete) - Updated KDE translations - kioslave and property-dialog now translate correctly - ppsocket: Added a patch for FreeBSD - plpftp: Some experimental code for testing
Diffstat (limited to 'lib/rpcs32.cc')
-rw-r--r--lib/rpcs32.cc72
1 files changed, 55 insertions, 17 deletions
diff --git a/lib/rpcs32.cc b/lib/rpcs32.cc
index 64ac5b4..b1cbe49 100644
--- a/lib/rpcs32.cc
+++ b/lib/rpcs32.cc
@@ -169,45 +169,83 @@ regReadIter(u_int16_t handle)
}
Enum<rfsv::errs> rpcs32::
-configOpen(void)
+configOpen(u_int16_t &handle, u_int32_t size)
{
bufferStore a;
Enum<rfsv::errs> res;
+ a.addDWord(size);
if (!sendCommand(rpcs::CONFIG_OPEN, a))
return rfsv::E_PSI_FILE_DISC;
res = getResponse(a, true);
- cout << "co: r=" << res << " a=" << a << endl;
- if (a.getLen() > 0)
- hhh = a.getDWord(0);
- return rfsv::E_PSI_GEN_NONE;
+ if (res == rfsv::E_PSI_GEN_NONE && (a.getLen() >= 2))
+ handle = a.getWord(0);
+ return res;
}
Enum<rfsv::errs> rpcs32::
-configRead(void)
+configRead(u_int32_t size, bufferStore &ret)
{
bufferStore a;
+ u_int16_t handle;
Enum<rfsv::errs> res;
- int l;
- FILE *f;
- f = fopen("blah", "w");
+ ret.init();
+ if ((res = configOpen(handle, size)) != rfsv::E_PSI_GEN_NONE)
+ return res;
do {
a.init();
- a.addDWord(hhh);
+ a.addWord(handle);
+ a.addDWord(2047);
if (!sendCommand(rpcs::CONFIG_READ, a))
return rfsv::E_PSI_FILE_DISC;
- if ((res = getResponse(a, true)) != rfsv::E_PSI_GEN_NONE)
+ if ((res = getResponse(a, true)) != rfsv::E_PSI_GEN_NONE) {
+ closeHandle(handle);
+ return res;
+ }
+ if (a.getLen() > 0)
+ ret.addBuff(a);
+ } while (a.getLen() > 0);
+ return rfsv::E_PSI_GEN_NONE;
+}
+
+Enum<rfsv::errs> rpcs32::
+configWrite(bufferStore data)
+{
+ bufferStore a;
+ u_int16_t handle;
+ Enum<rfsv::errs> res;
+
+ return rfsv::E_PSI_GEN_NONE;
+ if ((res = configOpen(handle, data.getLen())) != rfsv::E_PSI_GEN_NONE)
+ return res;
+ do {
+ a.init();
+ long l = (data.getLen() > 2047) ? 2047 : data.getLen();
+ a.addWord(handle);
+ a.addBuff(data, l);
+ data.discardFirstBytes(l);
+ if (!sendCommand(rpcs::CONFIG_WRITE, a))
+ return rfsv::E_PSI_FILE_DISC;
+ if ((res = getResponse(a, true)) != rfsv::E_PSI_GEN_NONE) {
+ closeHandle(handle);
return res;
- l = a.getLen();
- cout << "cr: " << l << endl;
- fwrite(a.getString(0), 1, l, f);
- } while (l > 0);
- fclose(f);
-//cout << "cr: r=" << res << " a=" << a << endl;
+ }
+ } while (data.getLen() > 0);
return rfsv::E_PSI_GEN_NONE;
}
+Enum<rfsv::errs> rpcs32::
+closeHandle(u_int16_t handle)
+{
+ bufferStore a;
+
+ a.addWord(handle);
+ if (!sendCommand(rpcs::CLOSE_HANDLE, a))
+ return rfsv::E_PSI_FILE_DISC;
+ return getResponse(a, true);
+}
+
/*
* Local variables:
* c-basic-offset: 4