Skip to contentSkip to conversation

em28xx: register device to soundcard for sysfs

PATCH Applied Nicola Soranzo 3 participants 5 messages Feb 19, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 em28xx: register device to soundcard for sysfs

As explained in "Writing an ALSA driver" (T. Iwai), audio drivers should set the struct device for the card before registering the card instance. This will add the correct /sys/class/sound/cardN/device symlink, so HAL can see the device and ConsoleKit sets its ACL permissions for the logged-in user.

For em28xx audio capture cards found e.g. in Hauppauge WinTV-HVR-900 (R2), this patch fixes errors like:

ALSA lib pcm_hw.c:1429:(_snd_pcm_hw_open) Invalid value for card Error opening audio: Permission denied

when running mplayer as a normal user.

Priority: normal

---

linux/drivers/media/video/em28xx/em28xx-audio.c +2 -0
diff -r 80e785538796 -r ef8cc17cc048 linux/drivers/media/video/em28xx/em28xx-audio.c
@@ -560,6 +560,8 @@
 	pcm->info_flags = 0;
 	pcm->private_data = dev;
 	strcpy(pcm->name, "Empia 28xx Capture");
+
+	snd_card_set_dev(card, &dev->udev->dev);
 	strcpy(card->driver, "Empia Em28xx Audio");
 	strcpy(card->shortname, "Em28xx Audio");
 	strcpy(card->longname, "Empia Em28xx Audio");
#1 lore raw
Quoted 1 line · Nicola Soranzo

As explained in "Writing an ALSA driver" (T. Iwai),

when writing a patch write the truth about where it comes from, eg. the author of the patch.

thanks,
Markus

Quoted 35 lines

audio drivers should
set the struct device for the card before registering the card instance. This will add the correct /sys/class/sound/cardN/device symlink, so HAL can see the device and ConsoleKit sets its ACL permissions for the logged-in user.

For em28xx audio capture cards found e.g. in Hauppauge WinTV-HVR-900 (R2), this patch fixes errors like:

ALSA lib pcm_hw.c:1429:(_snd_pcm_hw_open) Invalid value for card Error opening audio: Permission denied

when running mplayer as a normal user.

Priority: normal

---
diff -r 80e785538796 -r ef8cc17cc048 linux/drivers/media/video/em28xx/em28xx-audio.c

linux/drivers/media/video/em28xx/em28xx-audio.c Thu Feb 19 17:36:44 2009 +0100 renamed from linux/drivers/media/video/em28xx/em28xx-audio.c Wed Feb 18 18:27:33 2009 +0100 +2 -1
@@ -560,6 +560,8 @@
       pcm->info_flags = 0;
       pcm->private_data = dev;
       strcpy(pcm->name, "Empia 28xx Capture");
+
+       snd_card_set_dev(card, &dev->udev->dev);
       strcpy(card->driver, "Empia Em28xx Audio");
       strcpy(card->shortname, "Em28xx Audio");
       strcpy(card->longname, "Empia Em28xx Audio");
--

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

#2 lore raw

Alle giovedì 19 febbraio 2009, Markus Rechberger ha scritto:

Quoted 5 lines · Nicola Soranzo
Quoted 1 line

As explained in "Writing an ALSA driver" (T. Iwai),

when writing a patch write the truth about where it comes from, eg. the author of the patch.

I'm sorry Markus, but you're just the inspirer of the patch.
I wanted to use your code and so two weeks ago I asked you twice privately if it was ok for you, and you didn't answer me.
Then I checked the documentation cited above, changed the one-line patch to be more general and now it does not contain code from your tree anymore.

Anyway, thanks for the idea
Nicola

#3 lore raw
Quoted 4 lines · Nicola Soranzo

Alle giovedì 19 febbraio 2009, Markus Rechberger ha scritto:

Quoted 3 lines · Nicola Soranzo
Quoted 1 line

As explained in "Writing an ALSA driver" (T. Iwai),

Quoted 9 lines
Quoted 2 lines

when writing a patch write the truth about where it comes from, eg. the author of the patch.

I'm sorry Markus, but you're just the inspirer of the patch.
I wanted to use your code and so two weeks ago I asked you twice privately if it was ok for you, and you didn't answer me.
Then I checked the documentation cited above, changed the one-line patch to be more general and now it does not contain code from your tree anymore.

good to know :-) A short line stating out that the code was simply diffed from the
other repository would have been enough.

Quoted 1 line

Anyway, thanks for the idea

you're welcome.

Markus

#4 lore raw
In reply to Nicola Soranzo
Quoted 25 lines · On Thu, 19 Feb 2009 17:41:56 +0100 Nicola Soranzo <[email protected]> wrote:

As explained in "Writing an ALSA driver" (T. Iwai), audio drivers should set the struct device for the card before registering the card instance. This will add the correct /sys/class/sound/cardN/device symlink, so HAL can see the device and ConsoleKit sets its ACL permissions for the logged-in user.

For em28xx audio capture cards found e.g. in Hauppauge WinTV-HVR-900 (R2), this patch fixes errors like:

ALSA lib pcm_hw.c:1429:(_snd_pcm_hw_open) Invalid value for card Error opening audio: Permission denied

when running mplayer as a normal user.

Priority: normal

---
diff -r 80e785538796 -r ef8cc17cc048 linux/drivers/media/video/em28xx/em28xx-audio.c ---
a/linux/drivers/media/video/em28xx/em28xx-audio.c Wed Feb 18
18:27:33 2009 +0100 +++
b/linux/drivers/media/video/em28xx/em28xx-audio.c Thu Feb 19
17:36:44 2009 +0100 @@ -560,6 +560,8 @@ pcm->info_flags = 0; pcm->private_data = dev; strcpy(pcm->name, "Empia 28xx Capture");

linux/drivers/media/video/em28xx/em28xx-audio.c

Quoted 6 lines
linux/drivers/media/video/em28xx/em28xx-audio.c +2 -1
+
+	snd_card_set_dev(card, &dev->udev->dev);
 	strcpy(card->driver, "Empia Em28xx Audio");
 	strcpy(card->shortname, "Em28xx Audio");
 	strcpy(card->longname, "Empia Em28xx Audio");
--

Applied, thanks!

Cheers,
Douglas,