snd-usb-us428.patch.0.2
PATCH 1/1 snd-usb-us428.patch.0.2
Hi Takashi,
This is a Bugfix (sporadic hangups solved), cosmetical treatment and feature-enhancement (Setting of PCM-Out Volume according to Mastervolume-Slider at device start).
Please commit.
tnx,
Karsten
Index: alsa-driver/usb/us428/usX2Yhwdep.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/us428/usX2Yhwdep.c,v retrieving revision 1.2
usb/us428/usX2Yhwdep.c +10 -9
@@ -93,7 +93,7 @@return -EBUSY ;/* if userspace tries to mmap beyond end of our buffer, fail */ -if (size > ((PAGE_SIZE -1 +sizeof (us428ctls_sharedmem_t)) /PAGE_SIZE ) *PAGE_SIZE ){ +if (size > ((PAGE_SIZE -1 +sizeof (us428ctls_sharedmem_t)) /PAGE_SIZE ) *PAGE_SIZE ) {snd_printd ("%i > %i\n" , size,sizeof (us428ctls_sharedmem_t));return -EINVAL ; }
@@ -103,6 +103,7 @@if (!(us428->us428ctls_sharedmem =snd_malloc_pages (sizeof (us428ctls_sharedmem_t),GFP_KERNEL )))return -ENOMEM ;memset (us428->us428ctls_sharedmem,-1 ,sizeof (us428ctls_sharedmem_t)); + us428->us428ctls_sharedmem->CtlSnapShotLast =-2 ; } area->vm_ops = &us428ctls_vm_ops;#ifdef VM_RESERVED
@@ -174,11 +175,11 @@ i; us428->Seq04 =0 ; -if (NULL == (us428->AS04.buffer =kmalloc (URB_DataLen_AsyncSeq*URBS_AsyncSeq,GFP_KERNEL ))){ +if (NULL == (us428->AS04.buffer =kmalloc (URB_DataLen_AsyncSeq*URBS_AsyncSeq,GFP_KERNEL ))) { err = -ENOMEM ; }else -for (i =0 ; i < URBS_AsyncSeq; ++i){ -if (NULL == (us428->AS04.urb[i] =usb_alloc_urb (0 ,GFP_KERNEL ))){ +for (i =0 ; i < URBS_AsyncSeq; ++i) { +if (NULL == (us428->AS04.urb[i] =usb_alloc_urb (0 ,GFP_KERNEL ))) { err = -ENOMEM ;break ; }
@@ -219,7 +220,7 @@int err; do { - if ((err = snd_us428_create_usbmidi(card)) < 0){ + if ((err = snd_us428_create_usbmidi(card)) < 0) { snd_printk("snd_us428_create_alsa_devices: snd_us428_create_usbmidi error %i \n", err); break; }
@@ -238,7 +239,7 @@if (! (us428->In04urb =usb_alloc_urb (0 ,GFP_KERNEL )))return -ENOMEM ; -if (! (us428->In04Buf =kmalloc (21 ,GFP_KERNEL ))){ +if (! (us428->In04Buf =kmalloc (21 ,GFP_KERNEL ))) {usb_free_urb (us428->In04urb);return -ENOMEM ; }
@@ -276,15 +277,15 @@ } if (!err && 1 == dsp->index) do { - if ((err = snd_us428_AsyncSeq04_init((us428dev_t*)hw->private_data))){ + if ((err = snd_us428_AsyncSeq04_init((us428dev_t*)hw->private_data))) { snd_printk("snd_us428_AsyncSeq04_init error \n"); break; } - if ((err = snd_us428_In04_init((us428dev_t*)hw->private_data))){ + if ((err = snd_us428_In04_init((us428dev_t*)hw->private_data))) { snd_printk("snd_us428_In04_init error \n"); break; } - if ((err = snd_us428_create_alsa_devices(hw->card))){ + if ((err = snd_us428_create_alsa_devices(hw->card))) { snd_printk("snd_us428_create_alsa_devices error %i \n", err); snd_card_free(hw->card); break;
Index: alsa-driver/usb/us428/usbus428.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/us428/usbus428.c,v retrieving revision 1.5
usb/us428/usbus428.c +18 -11
@@ -75,7 +75,7 @@MODULE_AUTHOR ("Karsten Wiese <[email protected]>" ); -MODULE_DESCRIPTION ("TASCAM " NAME_ALLCAPS " Version 0.1" ); +MODULE_DESCRIPTION ("TASCAM " NAME_ALLCAPS " Version 0.2" );MODULE_LICENSE ("GPL" );MODULE_CLASSES ("{sound}" );MODULE_DEVICES ("{{TASCAM(0x1604), " NAME_ALLCAPS "(0x8001) }}" );
@@ -131,22 +131,29 @@ us428->In04IntCalls++; -if (urb->status){ +if (urb->status) {snd_printk ("Interrupt Pipe 4 came back with status=%i\n" , urb->status);return ; } - { -int diff =-1 , i;// printk("%i:0x%02X ", 8, (int)((unsigned char*)us428->In04Buf)[8]); Master volume shows 0 here if fader is at max during boot ?!? -for (i =0 ; i <21 ; i++) { -if (us428->In04Last[i] != ((char *)us428->In04Buf)[i]) { -if (diff <0 ) - diff = i; - us428->In04Last[i] = ((char *)us428->In04Buf)[i]; +if (us428ctls) { +int diff =-1 ; +if (-2 == us428ctls->CtlSnapShotLast) { + diff =0 ; +memcpy (us428->In04Last, us428->In04Buf,sizeof (us428->In04Last)); + us428ctls->CtlSnapShotLast =-1 ; + }else { +int i; +for (i =0 ; i <21 ; i++) { +if (us428->In04Last[i] != ((char *)us428->In04Buf)[i]) { +if (diff <0 ) + diff = i; + us428->In04Last[i] = ((char *)us428->In04Buf)[i]; + } } } -if (diff >=0 && us428ctls) { +if (0 <= diff) {int n = us428ctls->CtlSnapShotLast +1 ;if (n >= N_us428_ctl_BUFS || n <0 ) n =0 ;
@@ -186,7 +193,7 @@ } } -if (err){ +if (err) {snd_printk ("In04Int() usb_submit_urb err=%i\n" , err); } }
Index: alsa-driver/usb/us428/usbus428audio.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/us428/usbus428audio.c,v retrieving revision 1.5
usb/us428/usbus428audio.c +40 -52
267 lines not on this page · raw message