aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgermeier <germeier>2002-09-30 13:39:14 +0000
committergermeier <germeier>2002-09-30 13:39:14 +0000
commit00c1bbe81d62ef76e177ad710749192d346e34a5 (patch)
treee79cd56b6b5db50293724e3d7ed03f99b7ceb5a5
parenta67780579977111cc5e1905f42749f1d3004ead1 (diff)
downloadmpiosh-00c1bbe81d62ef76e177ad710749192d346e34a5.tar.gz
mpiosh-00c1bbe81d62ef76e177ad710749192d346e34a5.tar.bz2
mpiosh-00c1bbe81d62ef76e177ad710749192d346e34a5.zip
improved model identification.
-rw-r--r--ChangeLog6
-rw-r--r--libmpio/mpio.c25
2 files changed, 26 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b432f5..c3cb696 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-09-30 Markus Germeier <mager@tzi.de>
+
+ * libmpio/mpio.c (mpio_init): fixed identification of
+ newer firmwares (e.g. DMG+) "MPIOxy" vs. "MPIO-xy"
+ thanks to mathieu for reporting this one.
+
2002-09-28 Markus Germeier <mager@tzi.de>
* kernel/Makefile.am (distclean): added target distclean
diff --git a/libmpio/mpio.c b/libmpio/mpio.c
index 330a744..ec00f65 100644
--- a/libmpio/mpio.c
+++ b/libmpio/mpio.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: mpio.c,v 1.28 2002/09/28 00:32:41 germeier Exp $
+ * $Id: mpio.c,v 1.29 2002/09/30 13:39:14 germeier Exp $
*
* Library for USB MPIO-*
*
@@ -204,6 +204,7 @@ mpio_init(mpio_callback_init_t progress_callback)
{
mpio_t *new_mpio;
mpio_smartmedia_t *sm;
+ int id_offset;
new_mpio = malloc(sizeof(mpio_t));
if (!new_mpio) {
@@ -233,8 +234,19 @@ mpio_init(mpio_callback_init_t progress_callback)
snprintf(new_mpio->firmware.month, 3, "%s", new_mpio->version + 0x14);
snprintf(new_mpio->firmware.day, 3, "%s", new_mpio->version + 0x16);
+ /* there are different identification strings! */
+ if (strncmp(new_mpio->version, "MPIO", 4) != 0)
+ debug("MPIO id string not found, proceeding anyway...");
+
+ /* strings: "MPIOxy " */
+ id_offset = 4;
+
+ /* string: "MPIO-xy " */
+ if (new_mpio->version[id_offset] == '-')
+ id_offset++;
+
/* identify different versions */
- switch (new_mpio->version[5])
+ switch (new_mpio->version[id_offset])
{
case 'E':
new_mpio->model = MPIO_MODEL_DME;
@@ -244,16 +256,19 @@ mpio_init(mpio_callback_init_t progress_callback)
break ;
case 'G':
new_mpio->model = MPIO_MODEL_DMG;
- if (new_mpio->version[6] == 'P')
- new_mpio->model = MPIO_MODEL_DMG_PLUS; /* should be right */
+ if (new_mpio->version[id_offset+1] == 'P')
+ new_mpio->model = MPIO_MODEL_DMG_PLUS;
break ;
case 'B':
new_mpio->model = MPIO_MODEL_DMB;
- if (new_mpio->version[6] == 'P')
+ if (new_mpio->version[id_offset+1] == 'P')
new_mpio->model = MPIO_MODEL_DMB_PLUS;
break;
default:
new_mpio->model = MPIO_MODEL_UNKNOWN;
+ debug("Unknown version string found!\n"
+ "Please report this to: mpio-devel@lists.sourceforge.net\n");
+ hexdumpn(1, new_mpio->version, CMD_SIZE);
}
/* internal init */