Skip to contentSkip to conversation

Repair snd-usb-usx2y for usb 2.6.18; Take 2

PATCH In review Karsten Wiese 2 participants 2 messages Oct 4, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Repair snd-usb-usx2y for usb 2.6.18; Take 2

Hi Takashi,

In 2.6.18 urb->start_frame rolls over beyond INT_MAX. Without this patch, snd-usb-usx2y can not work on 2.6.18.

Patch is split into two parts:
1) usx2y_usb2-6-18_stable-kernel.patch for stable kernel and stable alsa-kernel.

2) usx2y_usb2-6-18_stable-driver.patch for stable alsa-driver.

2) needs 1) to be applied first.

Karsten

Repair snd-usb-usx2y for usb 2.6.18

urb->start_frame rolls over beyond MAX_INT now.
This is for stable kernel and stable alsa.

alsa-kernel/usb/usx2y/usbusx2yaudio.c renamed from alsa-kernel/usb/usx2y/usbusx2yaudio.c_ +6 -12
@@ -322,7 +322,7 @@
 		usX2Y_error_urb_status(usX2Y, subs, urb);
 		return;
 	}
-	if (likely((0xFFFF & urb->start_frame) == usX2Y->wait_iso_frame))
+	if (likely(urb->start_frame == usX2Y->wait_iso_frame))
 		subs->completed_urb = urb;
 	else {
 		usX2Y_error_sequence(usX2Y, subs, urb);
@@ -335,13 +335,9 @@
 		    atomic_read(&capsubs->state) >= state_PREPARED &&
 		    (playbacksubs->completed_urb ||
 		     atomic_read(&playbacksubs->state) < state_PREPARED)) {
-			if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) {
-				if (nr_of_packs() <= urb->start_frame &&
-				    urb->start_frame <= (2 * nr_of_packs() - 1))	// uhci and ohci
-					usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
-				else
-					usX2Y->wait_iso_frame +=  nr_of_packs();
-			} else {
+			if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame))
+				usX2Y->wait_iso_frame += nr_of_packs();
+			else {
 				snd_printdd("\n");
 				usX2Y_clients_stop(usX2Y);
 			}
@@ -495,7 +491,6 @@
 		if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
 			goto start;
 	}
-	usX2Y->wait_iso_frame = -1;
 
  start:
 	usX2Y_subs_startup(subs);
@@ -516,10 +511,9 @@
 				snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err);
 				err = -EPIPE;
 				goto cleanup;
-			} else {
-				if (0 > usX2Y->wait_iso_frame)
+			} else
+				if (i == 0)
 					usX2Y->wait_iso_frame = urb->start_frame;
-			}
 			urb->transfer_flags = 0;
 		} else {
 			atomic_set(&subs->state, state_STARTING1);
alsa-kernel/usb/usx2y/usx2yhwdeppcm.c renamed from alsa-kernel/usb/usx2y/usx2yhwdeppcm.c_ +5 -10
@@ -243,7 +243,7 @@
 		usX2Y_error_urb_status(usX2Y, subs, urb);
 		return;
 	}
-	if (likely((0xFFFF & urb->start_frame) == usX2Y->wait_iso_frame))
+	if (likely(urb->start_frame == usX2Y->wait_iso_frame))
 		subs->completed_urb = urb;
 	else {
 		usX2Y_error_sequence(usX2Y, subs, urb);
@@ -256,13 +256,9 @@
 	if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED &&
 	    (NULL == capsubs2 || capsubs2->completed_urb) &&
 	    (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) {
-		if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame)) {
-			if (nr_of_packs() <= urb->start_frame &&
-			    urb->start_frame <= (2 * nr_of_packs() - 1))	// uhci and ohci
-				usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
-			else
-				usX2Y->wait_iso_frame +=  nr_of_packs();
-		} else {
+		if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame))
+			usX2Y->wait_iso_frame += nr_of_packs();
+		else {
 			snd_printdd("\n");
 			usX2Y_clients_stop(usX2Y);
 		}
@@ -433,7 +429,6 @@
 		if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
 			goto start;
 	}
-	usX2Y->wait_iso_frame = -1;
 
  start:
 	usX2Y_usbpcm_subs_startup(subs);
@@ -459,7 +454,7 @@
 						goto cleanup;
 					}  else {
 						snd_printdd("%i\n", urb->start_frame);
-						if (0 > usX2Y->wait_iso_frame)
+						if (u == 0)
 							usX2Y->wait_iso_frame = urb->start_frame;
 					}
 					urb->transfer_flags = 0;

Repair snd-usb-usx2y for usb 2.6.18

urb->start_frame rolls over beyond MAX_INT now.
This is for stable alsa-driver.

alsa-driver/usb/usx2y/usx2yhwdeppcm.patch renamed from alsa-driver/usb/usx2y/usx2yhwdeppcm.patch_ +65 -9

116 lines not on this page · raw message

alsa-driver/usb/usx2y/usbusx2yaudio.patch renamed from alsa-driver/usb/usx2y/usbusx2yaudio.patch_ +73 -8

114 lines not on this page · raw message

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#1 lore raw

At Wed, 4 Oct 2006 13:19:54 +0200,

Quoted 6 lines · Karsten Wiese

Hi Takashi,

In 2.6.18 urb->start_frame rolls over beyond INT_MAX. Without this patch, snd-usb-usx2y can not work on 2.6.18.

Quoted 7 lines

Patch is split into two parts:
1) usx2y_usb2-6-18_stable-kernel.patch for stable kernel and stable alsa-kernel.

2) usx2y_usb2-6-18_stable-driver.patch for stable alsa-driver.

2) needs 1) to be applied first.

Both applied now. Thanks.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV