]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Change some timer ioctls due to confliction
authorTakashi Iwai <tiwai@suse.de>
Sun, 15 May 2005 14:47:03 +0000 (14:47 +0000)
committerTakashi Iwai <tiwai@suse.de>
Sun, 15 May 2005 14:47:03 +0000 (14:47 +0000)
Change values of some timer ioctls to avoid confliction with FIO* ioctls.
Use old ioctls if the timer protocol version doesn't match.

include/sound/asound.h
src/timer/timer_hw.c

index 72cb459f2c2a6e29dee363dd030dd28ef29c3894..9f7cef871de769f3d9da6d84bc65d118164ca468 100644 (file)
@@ -558,7 +558,7 @@ enum {
  *  Timer section - /dev/snd/timer
  */
 
-#define SNDRV_TIMER_VERSION            SNDRV_PROTOCOL_VERSION(2, 0, 3)
+#define SNDRV_TIMER_VERSION            SNDRV_PROTOCOL_VERSION(2, 0, 4)
 
 enum sndrv_timer_class {
        SNDRV_TIMER_CLASS_NONE = -1,
@@ -671,10 +671,11 @@ enum {
        SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info),
        SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params),
        SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status),
-       SNDRV_TIMER_IOCTL_START = _IO('T', 0x20),
-       SNDRV_TIMER_IOCTL_STOP = _IO('T', 0x21),
-       SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0x22),
-       SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0x23),
+       /* The following four ioctls are changed since 1.0.9 due to confliction */
+       SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0),
+       SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1),
+       SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0xa2),
+       SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
 };
 
 struct sndrv_timer_read {
index 4f64a616a7dd9c4b0b6d2c5fb14deb6ae12d8ad4..1fef1e43e10f973eef08124e8808d4fc09b746bd 100644 (file)
@@ -38,6 +38,13 @@ const char *_snd_module_timer_hw = "";
 
 #define SNDRV_TIMER_IOCTL_STATUS_OLD   _IOW('T', 0x14, struct sndrv_timer_status)
 
+enum {
+       SNDRV_TIMER_IOCTL_START_OLD = _IO('T', 0x20),
+       SNDRV_TIMER_IOCTL_STOP_OLD = _IO('T', 0x21),
+       SNDRV_TIMER_IOCTL_CONTINUE_OLD = _IO('T', 0x22),
+       SNDRV_TIMER_IOCTL_PAUSE_OLD = _IO('T', 0x23),
+};
+
 static int snd_timer_hw_close(snd_timer_t *handle)
 {
        snd_timer_t *tmr = handle;
@@ -140,11 +147,16 @@ static int snd_timer_hw_status(snd_timer_t *handle, snd_timer_status_t * status)
 static int snd_timer_hw_start(snd_timer_t *handle)
 {
        snd_timer_t *tmr;
+       unsigned int cmd;
 
        tmr = handle;
        if (!tmr)
                return -EINVAL;
-       if (ioctl(tmr->poll_fd, SNDRV_TIMER_IOCTL_START) < 0)
+       if (tmr->version < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+               cmd = SNDRV_TIMER_IOCTL_START_OLD;
+       else
+               cmd = SNDRV_TIMER_IOCTL_START;
+       if (ioctl(tmr->poll_fd, cmd) < 0)
                return -errno;
        return 0;
 }
@@ -152,11 +164,16 @@ static int snd_timer_hw_start(snd_timer_t *handle)
 static int snd_timer_hw_stop(snd_timer_t *handle)
 {
        snd_timer_t *tmr;
+       unsigned int cmd;
 
        tmr = handle;
        if (!tmr)
                return -EINVAL;
-       if (ioctl(tmr->poll_fd, SNDRV_TIMER_IOCTL_STOP) < 0)
+       if (tmr->version < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+               cmd = SNDRV_TIMER_IOCTL_STOP_OLD;
+       else
+               cmd = SNDRV_TIMER_IOCTL_STOP;
+       if (ioctl(tmr->poll_fd, cmd) < 0)
                return -errno;
        return 0;
 }
@@ -164,11 +181,16 @@ static int snd_timer_hw_stop(snd_timer_t *handle)
 static int snd_timer_hw_continue(snd_timer_t *handle)
 {
        snd_timer_t *tmr;
+       unsigned int cmd;
 
        tmr = handle;
        if (!tmr)
                return -EINVAL;
-       if (ioctl(tmr->poll_fd, SNDRV_TIMER_IOCTL_CONTINUE) < 0)
+       if (tmr->version < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+               cmd = SNDRV_TIMER_IOCTL_CONTINUE_OLD;
+       else
+               cmd = SNDRV_TIMER_IOCTL_CONTINUE;
+       if (ioctl(tmr->poll_fd, cmd) < 0)
                return -errno;
        return 0;
 }