]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
skypopen: tweaking the OSS audio driver
authorGiovanni Maruzzelli <gmaruzz@gmail.com>
Tue, 14 Dec 2010 12:45:43 +0000 (06:45 -0600)
committerGiovanni Maruzzelli <gmaruzz@gmail.com>
Tue, 14 Dec 2010 12:46:01 +0000 (06:46 -0600)
src/mod/endpoints/mod_skypopen/oss/main.c
src/mod/endpoints/mod_skypopen/oss/scull.h

index c1228d63f195f8f08e550ee7fb1e6a34863e4ee2..925441b254a7221fc7a86aca53cba2263e09b1d9 100644 (file)
@@ -67,6 +67,7 @@ void my_timer_callback_inq( unsigned long data )
 {
        struct scull_dev *dev = (void *)data;
 
+       dev->readable=1;
        wake_up_interruptible(&dev->inq);
        mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) );
 
@@ -76,6 +77,7 @@ void my_timer_callback_outq( unsigned long data )
 {
        struct scull_dev *dev = (void *)data;
 
+       dev->writable=1;
        wake_up_interruptible(&dev->outq);
        mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) );
 }
@@ -130,11 +132,11 @@ static int scull_c_open(struct inode *inode, struct file *filp)
        struct scull_dev *dev;
        dev_t key;
 
-       if (!current->tgid) { 
-               printk("Process \"%s\" has no tgid\n", current->comm);
+       if (!current->pid) { 
+               printk("Process \"%s\" has no pid\n", current->comm);
                return -EINVAL;
        }
-       key = current->tgid;
+       key = current->pid;
 
        /* look for a scullc device in the list */
        spin_lock(&scull_c_lock);
@@ -170,12 +172,14 @@ ssize_t scull_read(struct file *filp, char __user *buf, size_t count,
 {
        struct scull_dev *dev = filp->private_data;
 
-       DEFINE_WAIT(wait);
-       prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE);
-       schedule();
-       finish_wait(&dev->inq, &wait);
+       //DEFINE_WAIT(wait);
+       //prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE);
+       //schedule();
+       //finish_wait(&dev->inq, &wait);
        //memset(buf, 255, count);
 
+       wait_event_interruptible(dev->inq, dev->readable);
+       dev->readable=0;
        return count;
 
 }
@@ -184,10 +188,13 @@ ssize_t scull_write(struct file *filp, const char __user *buf, size_t count,
                loff_t *f_pos)
 {
        struct scull_dev *dev = filp->private_data;
-       DEFINE_WAIT(wait);
-       prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE);
-       schedule();
-       finish_wait(&dev->outq, &wait);
+       //DEFINE_WAIT(wait);
+       //prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE);
+       //schedule();
+       //finish_wait(&dev->outq, &wait);
+
+       wait_event_interruptible(dev->outq, dev->writable);
+       dev->writable=0;
 
        return count;
 
index e86281bd947778015df9c5e4ea85eeb063d6e190..565b8b38b7f49a3678d4de05f8698b8804d1639f 100644 (file)
@@ -34,6 +34,8 @@ struct scull_dev {
        wait_queue_head_t outq; /* read and write queues */
        struct timer_list timer_inq;
        struct timer_list timer_outq;
+       int readable;
+       int writable;
        //unsigned long read_howmany;
        //unsigned long write_howmany;
        //unsigned long read_sleeped_acc;