Re: Bad image/sound quality with Medion MD 95700

2009-12-25 Thread BOUWSMA Barry
On Fri, 25 Dec 2009, TAXI wrote:

 I tried a Medion MD 95700 with kernel 2.6.32 (for tests: 2.6.30.9) and
 have a very bad image and sound quality.

I have two of these boxes, and they work great -- but I've had to 
patch the kernel in different ways to have success.

One way for my production machine happily running 2.6.14 with 
patches, due to the fact that this kernel has a problem with
isochronous data being passed through an external hub -- the
95700 has a built-in hub to allow its built-in USB port to co-
exist with the datastream and the remote control.

The other way works for newer kernels, sort of, and looks for the
data on a different alternate interface where it can be found (but
it requires a kick in the pants to get it started), although it
is possible to successfully use either the isochronous or the bulk
datastream which the device delivers with these later modern 
kernels.

The other thing to note is that this device delivers a full
unfiltered Transport Stream, which with the 13,27Mbit/sec typical
bandwidth per channel used in your country (apart from some local
exceptions of greater values), will require a USB2 interface.

I mention this because the last multi-gigahertz-CPU machine I got
my grubby fingers on still had only a built-in USB1 chipset, 
although when you write:


 under windows XP the image and sound is perfect.

That leads me to believe you have a USB2 interface and can ignore
this -- although if you're somehow failing to load the EHCI driver
and falling back to the companion UHCI or EHCI USB1, it will be a
problem.  You may want to verify that -- I am thwarted by 
unco-operative hardware that prevents me from using numbered
kernel revisions as you mention as opposed to my custom kernels
direct from the `git' repository tuned to my hardware and usually
with more patches and hacks than are reasonable.


 [mpeg2video @ 0xc62be0]ac-tex damaged at 23 4
 [mpeg2video @ 0xc62be0]ac-tex damaged at 14 9
 [mpeg2video @ 0xc62be0]skipped MB in I frame at 40 10
 [mpeg2video @ 0xc62be0]invalid mb type in I Frame at 29 15
 [mpeg2video @ 0xc62be0]skipped MB in I frame at 32 19

This and the following errors can be caused by any number of 
reasons for a corrupt data stream -- inadequate bandwidth (use
of USB1 where USB2 is required for a complete Transport Stream),
improper antenna orientation, or, with certain kernel revisions,
attempting to read an isochronous data stream as bulk or vice
versa.



Ooops, I just rebooted after a crash before plugging in a more-
than-one-button-mouse on this machine I never intended to make
serious use of, so I can't paste the diffs, but...

around line 620 in my reference code, there is a line that sets
the alternate interface to 6.  This is expected to be bulk, but
on my boxes is isoc.

You can change this to interface 0, on which my boxes delivers
bulk data flawlessly.

I've attempted to add a test of what sort of data is present on
this interface, and if it's not bulk, decides to read isoc data
from this interface (6) instead.  That also works, but somehow
needs an extra kick such that the first time it fails, yet is
fine after that.  (I get occasional failures from other tuner
cards that work fine immediately after, so I've worked around
this in the scripts I use.)



Anyway, I've been meaning to clean up this patch, or the 
alternative patches, and submit them to be ignored, but when
I have my machine operating fully again (yeahright), I can send
you some of these alternative patches to try -- running 
successfully on 2.6.14 and 2.6.27-rc4.


Hope this is helpful in spite of its vagueness...


thanks
barry bouwsma
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bad image/sound quality with Medion MD 95700

2009-12-25 Thread TAXI
BOUWSMA Barry schrieb:
 The other thing to note is that this device delivers a full
 unfiltered Transport Stream, which with the 13,27Mbit/sec typical
 bandwidth per channel used in your country (apart from some local
 exceptions of greater values), will require a USB2 interface.
it is a USB2 interface:
[3.965425] usb 1-3.1: new high speed USB device using ehci_hcd and
address 6 (it's the USB hub in the box)

I also thought the USB chipset could be the problem and testet it with
an extra USB2 card.

 around line 620 in my reference code, there is a line that sets
 the alternate interface to 6.  This is expected to be bulk, but
 on my boxes is isoc.
 
 You can change this to interface 0, on which my boxes delivers
 bulk data flawlessly.
I think isoc would be okay on 2.6.32, so no need to change that, right?

 but when
 I have my machine operating fully again (yeahright), I can send
 you some of these alternative patches to try -- running 
 successfully on 2.6.14 and 2.6.27-rc4.
That would be nice.

P.S. my english is not the best so I don't understand all you wrote but
why don't you put the patches upstream?
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bad image/sound quality with Medion MD 95700

2009-12-25 Thread BOUWSMA Barry
Moin moin, TAXI...

On Fri, 25 Dec 2009, TAXI wrote:

 BOUWSMA Barry schrieb:
  The other thing to note is that this device delivers a full
  unfiltered Transport Stream, which with the 13,27Mbit/sec typical
  bandwidth per channel used in your country (apart from some local
  exceptions of greater values), will require a USB2 interface.

 it is a USB2 interface:
 [3.965425] usb 1-3.1: new high speed USB device using ehci_hcd and
 address 6 (it's the USB hub in the box)

Na gut -- so habe ich erwartet.  Aber sicher ist sicher, vertrauen 
ist gut, usw.

Or in english, I expected that, but it is always good to be sure, 
as it is one of the problems or bottlenecks which I regularly
experience.


  around line 620 in my reference code, there is a line that sets
  the alternate interface to 6.  This is expected to be bulk, but
  on my boxes is isoc.
  
  You can change this to interface 0, on which my boxes delivers
  bulk data flawlessly.

 I think isoc would be okay on 2.6.32, so no need to change that, right?

Das Problem ist, der Treiber erwartet BULK Datei, nicht ISOC, aber
das Kistchen liefert ISOC (isochronous) Datei.  Deswegen kommt es
zu Probleme.

Or, the thing is, Linux is expecting to be seeing bulk data on 
this particular alternate interface (6).  If the receiver is not
delivering this, but is instead delivering isochronous data, it's
not in the same format and isn't properly handled by the driver.

Changing it so that the driver reads from alternate interface 0
results in all my hacked versions being able to read the data
properly.  Even before reading isoc data through hubs was fixed
sometime around or before 2.6.18-ish.



  but when
  I have my machine operating fully again (yeahright), I can send
  you some of these alternative patches to try -- running 
  successfully on 2.6.14 and 2.6.27-rc4.

 That would be nice.
 
 P.S. my english is not the best so I don't understand all you wrote but
 why don't you put the patches upstream?

Mein deutsch ist noch schlimmer, wie Du siehst  :-)  Verzeihung 
wegen meine Muttersprache -- gerne schreibe ich, falls moeglich,
einfacher und verstaendlich.

Es gibt zwei moegliche Loesungen, entweder einen anderen Dateityp
aus'm `Endpunkt' zu lesen, oder aus ein anderem `Endpunkt' lesen.
Mein Kode ist leider nicht sauber.  Es laeuft bei mir, aber 
koennte Probleme bei anderen verursachen.  Ich kann keine 
Unterschiede zwischen `bulk' und `isoc' Datei auch mit 'nem 
200MHz Server feststellen, und kann deswegen keine gute Wahl 
zwischen die beiden entscheiden.  Ich bin auch mit meiner Loesung 
nicht ganz zufrieden.

Or, I hope you see from my dreadful sentences above that you need
not be ashamed of your english, but I will be happy to re-phrase
and try to clarify anything I have written.

My work-in-progress patches try to use the two possible solutions,
without affecting anyone whose receivers work, but I have not 
found a clear reason to favour one solution over the other.  The
solution which I think stomps less on the existing code is not
perfect (first tuning fails), and after getting my receivers to
work with both possibilities, I have not tried to clean up the
two solutions for submissions as possible patches.


Hast Du die 2.6.32 Quellkode?  Kannst Du aus `patches' etwas 
schaffen, und dabei die beide Moeglichkeiten testen?

(Are you able to build a new kernel to test my patches to see
if they solve your problem?)


barry bouwsma
('tschuldigung, wegen moi' Tastatur, Grammatik, Woerterschatz,
und allgemein Bloedheit)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bad image/sound quality with Medion MD 95700

2009-12-25 Thread TAXI
BOUWSMA Barry schrieb:
  Das Problem ist, der Treiber erwartet BULK Datei, nicht ISOC, aber
  das Kistchen liefert ISOC (isochronous) Datei.  Deswegen kommt es
  zu Probleme.
 
  Or, the thing is, Linux is expecting to be seeing bulk data on
  this particular alternate interface (6).  If the receiver is not
  delivering this, but is instead delivering isochronous data, it's
  not in the same format and isn't properly handled by the driver.
 
  Changing it so that the driver reads from alternate interface 0
  results in all my hacked versions being able to read the data
  properly.  Even before reading isoc data through hubs was fixed
  sometime around or before 2.6.18-ish.
und diese verwechslung verursacht die bild-/tonfehler?

and this confusion causes the image/sound issues?

  Hast Du die 2.6.32 Quellkode?  Kannst Du aus `patches' etwas
  schaffen, und dabei die beide Moeglichkeiten testen?
 
  (Are you able to build a new kernel to test my patches to see
  if they solve your problem?)

Ja habe ich. Leichte patch anpassungen bekomme ich meist auchnoch hin.
Wirklich programmieren kann ich aber nicht.

Yes I have. I have little skills in patch adjustments (very little). But
I'm not a developer so I have no coding skills.

Vielen Dank im vorraus für deine Hilfe.
Thank you in advance for your help.

P.S. a few words in my text are google translated  ;)



//forgotten to set the mailer in CC ;)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bad image/sound quality with Medion MD 95700

2009-12-25 Thread BOUWSMA Barry
On Fri, 25 Dec 2009, TAXI wrote:

  I have my machine operating fully again (yeahright), I can send
  you some of these alternative patches to try -- running 
  successfully on 2.6.14 and 2.6.27-rc4.

 That would be nice.

Hintergrund (aber nicht so wightig)...

I have not had the chance to update my `git' kernel source since 
more than a month, and even then, it is on a disk which I cannot
plug in at present.  The latest source I have at hand which I've
patched is 2.6.27-rc4.  There may be some differences from the
present code, so I am not sending a normal patch.

(Ich verwende aeltere Quellcode, deswegen musst Du per Hand
etwas aendern)


THIS IS NOT A PATCH TO BE APPLIED BY EVERYONE.  This is only to
verify that you are seeing the same problem I have had.

As I do not have a simple patch, I will give you the simple
changes to be made by hand.  Either way should give you a working
receiver, and both, but not together, should work.


Make a copy of the source file...
$  cd (your linux source)
$  cd drivers/media/dvb/dvb-usb
$  cp -pvi  cxusb.c  cxusb.c-DIST

Edit cxusb.c

find the function
cxusb_cx22702_frontend_attach
  ^^^
it should have the line
if (usb_set_interface(adap-dev-udev, 0, 6)  0)
 ^^^
or something very similar -- change this 6 to 0.

This will cause the driver to look at alternate interface 0 for
bulk data.

Now rebuild the kernel or the dvb_usb_cxusb module, reboot or load
the new module, and try it and see if it is better.


I will send a second alternative patch, to read isoc data from
interface 6, in a separate message.


barry bouwsma
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bad image/sound quality with Medion MD 95700

2009-12-25 Thread TAXI
BOUWSMA Barry schrieb:
 Now rebuild the kernel or the dvb_usb_cxusb module, reboot or load
 the new module, and try it and see if it is better.
Great job, it works!

Thank you so much :)
Should we try the isoc transfer now?
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bad image/sound quality with Medion MD 95700

2009-12-25 Thread BOUWSMA Barry
On Fri, 25 Dec 2009, TAXI wrote:

 BOUWSMA Barry schrieb:
  Now rebuild the kernel or the dvb_usb_cxusb module, reboot or load
  the new module, and try it and see if it is better.

 Great job, it works!
 
 Thank you so much :)
 Should we try the isoc transfer now?

Yes.

I wish I could find a clean patch that I used in the past -- but
it is hidden on a disk...  somewhere...  somewhere...

I may have to send an untested patch.  Boy, I wish I could copy
and paste with my mouse  :-)


Here is some source code which I have from 2005, with the ISOC
parameters that used to be used...


.generic_bulk_ctrl_endpoint = 0x01,
/* parameter for the MPEG2-data transfer */
.urb = {
.type = DVB_USB_ISOC,
.count = 5,
.endpoint = 0x02,
.u = {
.isoc = {
.framesperurb = 32,
.framesize = 940,
.interval = 5,
}
}
},

.num_device_descs = 1,
.devices = {
{   Medion MD95700 (MDUSBTV-HYBRID),



The idea is to fit this into the cxusb_medion_properties that
is probably near line 900 of your present source, plus or minus
however many changes there have been in the past five kernel
releases since my 2.6.27-rc4.

These are the lines which now look much like  .type = USB_BULK,
and so on.


THIS IS NOT A CHANGE WHICH NORMAL USERS SHOULD TRY TO MAKE.
IT WILL ONLY WORK FOR THE ORIGINAL UN-MODDED MEDION 95700.

Of course, you will first want to
$  mv -iv cxusb.c  cxusb.c-bulk-hack
$  cp -pvi  cxusb.c-DIST  cxusb.c
then make your changes to the unchanged original cxusb.c


In a later patch which I have intended to be compatible for all
users, I have this set somewhere else, with lines similar to


+#else
+/* XXX try to switch to using ISOC instead of BULK */
+/* XXX debug */err(attempting to use isoc transfers on alt6 
ep);
+   props-adapter-stream.type = USB_ISOC;
+   props-adapter-stream.u.isoc.framesperurb = 32;
+   props-adapter-stream.u.isoc.framesize = 940;
+   props-adapter-stream.u.isoc.interval = 5;
+
+#endif /* XXX HACK */


But this patch is very messy, and I must clean it up before I
can even think of posting it to the list...


I hope this can get you started, as I continue to search for a
simple patch which does the above, but correctly.


batty bouwsma
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html