diff mbox

Probably strange bug with usb radio-mr800

Message ID 208cbae30905271051jfe3294bye415b5b4cd0ce14b@mail.gmail.com (mailing list archive)
State RFC
Headers show

Commit Message

Alexey Klimov May 27, 2009, 5:51 p.m. UTC
Hello,

Doing some improvements in media/radio/radio-mr800.c i see very
strange situation.
I made simple patch that removed usb_amradio_open function. There is
no need in this function (no need to start/set frequency radio in open
procedure, and also removed lock/unlock_kernel() calls).
Here is this patch:


Then i test it. I have two machines: pentium-m and athlon 64 X2 dual
core. Kernel is 2.6.30-rc7 on both machines.
After patch such tools like fmtools, gnomeradio, kradio works fine
with radio. But mplayer didn't.

On 64bit machine mplayer didn't start radio. I ask usbmon to help me
and here is messages from usbmon:

cat /sys/kernel/debug/usbmon/2u
ffff880022e380c0 1662784522 S Io:2:003:2 -115:64 8 = 0055aa00 ab010000
(this message stops radio)
ffff880022e380c0 1662799160 C Io:2:003:2 0:64 8 >
ffff880022e380c0 1662799273 S Io:2:003:2 -115:64 8 = 0055aa00 ae000000
(this ask radio to have stereo signal)
ffff880022e380c0 1662831161 C Io:2:003:2 0:64 8 >
ffff880022e380c0 1662831439 S Io:2:003:2 -115:64 8 = 0055aa03 a4000008
(this and next message set frequency)
ffff880022e380c0 1662863161 C Io:2:003:2 0:64 8 >
ffff880022e380c0 1662863233 S Io:2:003:2 -115:64 8 = 1dd00100 00000000
ffff880022e380c0 1662895155 C Io:2:003:2 0:64 8 >
ffff880022e380c0 1662895190 S Io:2:003:2 -115:64 8 = 0055aa00 ab000000
(this message starts radio)
ffff880022e380c0 1662927156 C Io:2:003:2 0:64 8 >

Well, there is no sound from usb device after that.

On 32bit machine mplayer starts radio fine and works ok. Usbmon shows
me the same messages:

tux ~ # cat /sys/kernel/debug/usbmon/0u
f6530900 2647820070 S Io:2:002:2 -115:64 8 = 0055aa00 ab010000
f6530900 2647859740 C Io:2:002:2 0:64 8 >
f6530900 2647859825 S Io:2:002:2 -115:64 8 = 0055aa00 ae000000
f6530900 2647923747 C Io:2:002:2 0:64 8 >
f6530900 2647923942 S Io:2:002:2 -115:64 8 = 0055aa03 a4000008
f6530900 2647987749 C Io:2:002:2 0:64 8 >
f6530900 2647987766 S Io:2:002:2 -115:64 8 = 1dcf0100 00000000
f6530900 2648051747 C Io:2:002:2 0:64 8 >
f6530900 2648051775 S Io:2:002:2 -115:64 8 = 0055aa00 ab000000
f6530900 2648115753 C Io:2:002:2 0:64 8 >

So, the same messages to device works fine with radio on 32bit machine
and nothing on 64bit machine.
Good thing is if i add one more start message radio works on 64bit machine also.

Is this usb subsystem bug?
Should i make some workaround to deal with this and add comments about mplayer?

Comments

Alexey Klimov June 4, 2009, 10:43 p.m. UTC | #1
Is there any ideas about different behaviour of device on 32- and
64-bit platforms with the same usb bulk messages?
Any input is welcome.

On Wed, May 27, 2009 at 9:51 PM, Alexey Klimov<klimov.linux@gmail.com> wrote:

[...]

> So, the same messages to device works fine with radio on 32bit machine
> and nothing on 64bit machine.
> Good thing is if i add one more start message radio works on 64bit machine also.
>
> Is this usb subsystem bug?
> Should i make some workaround to deal with this and add comments about mplayer?
Greg Kroah-Hartman June 4, 2009, 10:53 p.m. UTC | #2
On Fri, Jun 05, 2009 at 02:43:04AM +0400, Alexey Klimov wrote:
> Is there any ideas about different behaviour of device on 32- and
> 64-bit platforms with the same usb bulk messages?

No, there should be no difference.

Have you run usbmon to look at the data on the wire?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexey Klimov June 5, 2009, 8:54 a.m. UTC | #3
On Fri, Jun 5, 2009 at 2:53 AM, Greg KH<gregkh@suse.de> wrote:
> On Fri, Jun 05, 2009 at 02:43:04AM +0400, Alexey Klimov wrote:
>> Is there any ideas about different behaviour of device on 32- and
>> 64-bit platforms with the same usb bulk messages?
>
> No, there should be no difference.
>
> Have you run usbmon to look at the data on the wire?

Of course, there is my first letter (from May 27) on usb and v4l mail
lists with usbmon output.
Here is the link http://www.spinics.net/lists/linux-media/msg06051.html
Oliver Neukum June 6, 2009, 9:07 p.m. UTC | #4
Am Freitag, 5. Juni 2009 00:43:04 schrieb Alexey Klimov:
> Is there any ideas about different behaviour of device on 32- and
> 64-bit platforms with the same usb bulk messages?
> Any input is welcome.

Are you running a 32 bit userland? If so, ioctls could be critical.
If not, the driver may not be 64bit clean. Which driver is affected?

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexey Klimov June 7, 2009, 1:41 p.m. UTC | #5
Hello,

On Sun, Jun 7, 2009 at 1:07 AM, Oliver Neukum<oliver@neukum.org> wrote:
> Am Freitag, 5. Juni 2009 00:43:04 schrieb Alexey Klimov:
>> Is there any ideas about different behaviour of device on 32- and
>> 64-bit platforms with the same usb bulk messages?
>> Any input is welcome.
>
> Are you running a 32 bit userland? If so, ioctls could be critical.

Two different machines. The answer is no.

> If not, the driver may not be 64bit clean. Which driver is affected?

media/radio/radio-mr800.c
Please, also take a look in my first letter to usb and v4l mail lists
from May 27.
Oliver Neukum June 8, 2009, 11:03 a.m. UTC | #6
Am Sonntag, 7. Juni 2009 15:41:13 schrieb Alexey Klimov:

> > If not, the driver may not be 64bit clean. Which driver is affected?
>
> media/radio/radio-mr800.c

I can see no obvious 64bit problem.

> Please, also take a look in my first letter to usb and v4l mail lists
> from May 27.

Please resend that and put linux-usb@vger.kernel.org into cc.

	Regards
		Oliver

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

Patch

diff -r a344b328a34b linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c	Wed May 27 21:21:36 2009 +0400
+++ b/linux/drivers/media/radio/radio-mr800.c	Wed May 27 21:25:41 2009 +0400
@@ -119,7 +119,6 @@ 
 static int usb_amradio_probe(struct usb_interface *intf,
 			     const struct usb_device_id *id);
 static void usb_amradio_disconnect(struct usb_interface *intf);
-static int usb_amradio_open(struct file *file);
 static int usb_amradio_close(struct file *file);
 static int usb_amradio_suspend(struct usb_interface *intf,
 				pm_message_t message);
@@ -533,40 +532,6 @@ 
 	return 0;
 }

-/* open device - amradio_start() and amradio_setfreq() */
-static int usb_amradio_open(struct file *file)
-{
-	struct amradio_device *radio = video_get_drvdata(video_devdata(file));
-	int retval;
-
-	lock_kernel();
-
-	radio->users = 1;
-	radio->muted = 1;
-
-	retval = amradio_set_mute(radio, AMRADIO_START);
-	if (retval < 0) {
-		amradio_dev_warn(&radio->videodev->dev,
-			"radio did not start up properly\n");
-		radio->users = 0;
-		unlock_kernel();
-		return -EIO;
-	}
-
-	retval = amradio_set_stereo(radio, WANT_STEREO);
-	if (retval < 0)
-		amradio_dev_warn(&radio->videodev->dev,
-			"set stereo failed\n");
-
-	retval = amradio_setfreq(radio, radio->curfreq);
-	if (retval < 0)
-		amradio_dev_warn(&radio->videodev->dev,
-			"set frequency failed\n");
-
-	unlock_kernel();
-	return 0;
-}
-
 /*close device */
 static int usb_amradio_close(struct file *file)
 {
@@ -623,7 +588,6 @@ 
 /* File system interface */
 static const struct v4l2_file_operations usb_amradio_fops = {
 	.owner		= THIS_MODULE,
-	.open		= usb_amradio_open,
 	.release	= usb_amradio_close,
 	.ioctl		= video_ioctl2,
 };