OSDN Git Service

PCM: Allow to run older version of extplug plugin
authorTakashi Iwai <tiwai@suse.de>
Wed, 15 Aug 2012 15:05:37 +0000 (17:05 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 15 Aug 2012 15:05:37 +0000 (17:05 +0200)
Also show the incompatible plugin version number in error messages.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_extplug.c
src/pcm/pcm_ioplug.c

index a34706f..289fc78 100644 (file)
@@ -641,8 +641,11 @@ int snd_pcm_extplug_create(snd_pcm_extplug_t *extplug, const char *name,
        assert(extplug->callback->transfer);
        assert(slave_conf);
 
-       if (extplug->version != SND_PCM_EXTPLUG_VERSION) {
-               SNDERR("extplug: Plugin version mismatch\n");
+       /* We support 1.0.0 to current */
+       if (extplug->version < 0x010000 ||
+           extplug->version > SND_PCM_EXTPLUG_VERSION) {
+               SNDERR("extplug: Plugin version mismatch: 0x%x\n",
+                      extplug->version);
                return -ENXIO;
        }
 
@@ -668,7 +671,7 @@ int snd_pcm_extplug_create(snd_pcm_extplug_t *extplug, const char *name,
        ext->plug.undo_write = snd_pcm_plugin_undo_write_generic;
        ext->plug.gen.slave = spcm;
        ext->plug.gen.close_slave = 1;
-       if (extplug->callback->init)
+       if (extplug->version >= 0x010001 && extplug->callback->init)
                ext->plug.init = snd_pcm_extplug_init;
 
        err = snd_pcm_new(&pcm, SND_PCM_TYPE_EXTPLUG, name, stream, mode);
index 2aa7572..55be62d 100644 (file)
@@ -917,7 +917,8 @@ int snd_pcm_ioplug_create(snd_pcm_ioplug_t *ioplug, const char *name,
        /* We support 1.0.0 to current */
        if (ioplug->version < 0x010000 ||
            ioplug->version > SND_PCM_IOPLUG_VERSION) {
-               SNDERR("ioplug: Plugin version mismatch\n");
+               SNDERR("ioplug: Plugin version mismatch: 0x%x\n",
+                      ioplug->version);
                return -ENXIO;
        }