Matthew Donoughe wrote:
> Hello
> 
> I was having trouble watching TV and I tracked it down to the maximum  
> packet size being set incorrectly on big endian systems. Changing
> dvb_dev->dtv_packetsize = dev->uif- 
>  >altsetting[1].endpoint[i].desc.wMaxPacketSize;
> to
> dvb_dev->dtv_packetsize = le16_to_cpu(dev->uif- 
>  >altsetting[1].endpoint[i].desc.wMaxPacketSize);
> on line 1029 of em2880-dvb.c fixes the problem for me. em28xx- 
> audioep.c already does the same endianness conversion.


In struct usb_endpoint_descriptor the wMaxPacketSize field is in LE16
encoding, see linux/include/linux/usb/ch9.h . Add the missing le16_to_cpu()
and __constant_cpu_to_le16() calls.
diff -r 63cfb1b72ab6 em2880-dvb.c
--- a/em2880-dvb.c	Wed Dec 31 12:54:27 2008 +0100
+++ b/em2880-dvb.c	Fri Jan 02 08:00:16 2009 +0100
@@ -1026,8 +1026,9 @@
 
 	for (i = 0; i < dev->uif->altsetting[1].desc.bNumEndpoints; i++) {
 		if (dev->uif->altsetting[1].endpoint[i].desc.bEndpointAddress == 0x84) {
-			dvb_dev->dtv_packetsize = dev->uif->altsetting[1].
-					endpoint[i].desc.wMaxPacketSize;
+			dvb_dev->dtv_packetsize =
+				le16_to_cpu(dev->uif->altsetting[1].endpoint[i].
+				desc.wMaxPacketSize);
 			break;
 		}
 	}
diff -r 63cfb1b72ab6 em28xx-video.c
--- a/em28xx-video.c	Wed Dec 31 12:54:27 2008 +0100
+++ b/em28xx-video.c	Fri Jan 02 08:00:16 2009 +0100
@@ -4042,7 +4042,8 @@
 	endpoint = &interface->cur_altsetting->endpoint[0].desc;
 	if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
 			USB_ENDPOINT_XFER_ISOC &&
-		(interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) {
+		(interface->altsetting[1].endpoint[0].desc.wMaxPacketSize ==
+			__constant_cpu_to_le16(940))) {
 		printk(KERN_INFO "em28xx: DTV Device detected\n");
 		is_em2875 = 1;
 	} else {
_______________________________________________
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx

Reply via email to