With HPI-B.03, SA Forum introduced a version check in saHpiInitialize().
The version check currently only returns SA_OK, when there is an exact match.
Thus OpenHPI would provide no backward compatibility at all.
I think OpenHPI will always provide backward compatibility up (down?) to a certain version.
So I suggest to change saHpiInitialize (defined in baselib/oh_client.cpp, line 149) to return with SA_ERR_HPI_UNSUPPORTED_API
if RequestedVersion > SAHPI_INTERFACE_VERSION or RequestedVersion < the first version we support.
SAHPI_INTERFACE_VERSION is currently set on 0x020302 (for B.03.02), and I expect the first supported version
will be 0x020101 = B.01.01.
This kind of version check would be not 100% exact, since it would allow version B.02.99 (which doesn't exist ;-) ),
but it would allow a user to use an intermediate correction version by SAF, if they would publish one.
As an alternative we would need to check for all known SAF versions we support. I think that would mean B.01.01,
B.02.01, B.03.01 and B.03.02 with OpenHPI-2.15.
Agreed.
Another part of the problem is - there is HPI spec versions and OpenHPI versions.
I recall OpenHPI-2.8 and OpenHPI-2.10 were not compatible due to network RPC changes.
Not sure about 2.10 - 2.12.
2.12 is compatible with 2.14.
OK.
Compatibility of library and daemon is important. But the user will not care.
Do you like me to provide a patch for saHpiInitialize?
If yes, which way to go?
Yes, it would be great to have a patch from you.
I suggest introduce OH_SAHPI_INTERFACE_VERSION_MIN_SUPPORTED and OH_SAHPI_INTERFACE_VERSION_MAX_SUPPORTED in include/oHpi.h
Not sure the names sound good.
The patch below should fix it.
I used the proposed names, I find them good enough ;-).
I tested the attached patch with hpitest-3.1.1. The compatibility test is now ok. However other tests for saHpiInitialize still fail.
--- orig/include/oHpi.h 2010-06-09 12:18:34.000000000 +0200
+++ patched/include/oHpi.h 2010-06-09 12:19:00.000000000 +0200
@@ -23,6 +23,9 @@
#define OPENHPI_DEFAULT_DAEMON_PORT 4743
#define MAX_PLUGIN_NAME_LENGTH 32
+#define OH_SAHPI_INTERFACE_VERSION_MIN_SUPPORTED (SaHpiVersionT)0x020101 /* B.01.01 */
+#define OH_SAHPI_INTERFACE_VERSION_MAX_SUPPORTED SAHPI_INTERFACE_VERSION
+
typedef SaHpiUint32T oHpiHandlerIdT;
typedef struct {
--- orig/baselib/oh_client.cpp 2010-06-09 12:30:48.000000000 +0200
+++ patched/baselib/oh_client.cpp 2010-06-09 12:29:25.000000000 +0200
@@ -146,7 +146,8 @@
SAHPI_OUT SaHpiUint32T *FailedOption,
SAHPI_OUT SaErrorT *OptionError)
{
- if ( RequestedVersion != SAHPI_INTERFACE_VERSION ) {
+ if ( RequestedVersion < OH_SAHPI_INTERFACE_VERSION_MIN_SUPPORTED ) ||
+ ( RequestedVersion > OH_SAHPI_INTERFACE_VERSION_MAX_SUPPORTED ) {
return SA_ERR_HPI_UNSUPPORTED_API;
}
if ( ( NumOptions != 0 ) && ( Options == NULL ) ) {
Introduced
OH_SAHPI_INTERFACE_VERSION_MIN_SUPPORTED and
OH_SAHPI_INTERFACE_VERSION_MAX_SUPPORTED
Minimum supported version set to B.01.01,
Maximum supported version set to current (saHpi.h) version.