Add snd-usb-audio and snd-powermac support to sound wizard

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
John Doe
Posts: 1681
Joined: Mon 01 Aug 2005, 04:46
Location: Michigan, US

Add snd-usb-audio and snd-powermac support to sound wizard

#1 Post by John Doe »

Open /usr/sbin/alsaconf and change line 1231 to this:

Code: Select all

devs_found=("${devs_found[@]}" "legacy" "Probe legacy ISA (non-PnP) chips" "usb-audio" "USB Sound Device" "aoa" "Apple Onboard Audio Driver")
I have tested this with USB and it works. According to the post referenced in this post, it should work with MAC too (I think that driver was in there):

http://www.murga-linux.com/puppy/viewto ... 5086#95086

*edit. I fixed the apple var for the 2.6.18 kernel or greater. If using a previous kernel version, change "aoa" to "powermac".

*edit2. (*Fixed below) The volume control gets "funky" after doing the above for USB. WHen I mouse over it errors. I'll try to work around it.
Last edited by John Doe on Wed 07 Feb 2007, 00:02, edited 1 time in total.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

John,
I have just now discovered this post and your other one about Skype.

So, that modification for alsaconf, can that be made permanently for
everyone? I mean, should I do this for the original alsaconf so it will be in the official live-CD?

John Doe
Posts: 1681
Joined: Mon 01 Aug 2005, 04:46
Location: Michigan, US

#3 Post by John Doe »

Yes, please consider including this. I think it will help many people.

Important /usr/sbin/mini-volume.tcl notes:

Line 41

Code: Select all

proc setvolume { level } {
	if {[catch {exec setvol 0 $level} errmsg]} {
		exec amixer sset 'Speaker' $level
	}
}
Line 47

Code: Select all

proc getvolume { } {
	set volcommand { setvol 0 | cut -d" " -f2 }
	set volcommand2 { amixer sget 'Speaker' | grep 'Left: Playback [0-9]'}
	if {[catch {set volValue [exec sh -c ($volcommand)]} errmsg]} {
		regexp { [0-9]+ } [exec sh -c ($volcommand2)] volValue
	set gain $volValue
	} else {
	set gain $volValue
	}
}
It appears that setvol doesn't play nice with USB sound (*see two posts down). These changes will allow the tray volume app to try and use amixer for USB sound devices.

I double checked to make sure that this would still function properly with current sound cards (my initial try didn't).

I've been flipping my default sound device back and forth between built-in and USB headphones for the past hour. It works great.

Other than gxine volume slider not working.
Last edited by John Doe on Sat 10 Feb 2007, 02:04, edited 3 times in total.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#4 Post by BarryK »

Could you please tell rarsa about that, the mini-volume control is his baby.

John Doe
Posts: 1681
Joined: Mon 01 Aug 2005, 04:46
Location: Michigan, US

#5 Post by John Doe »

Will do.

Another note for the thread:

For some reason (as I've yet to determine) puppy does not remember the USB audio settings on a reboot. It goes back to the internal device. I'll keep trouble shooting on it.

(it's still nice to have the feature, none the less)

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#6 Post by rarsa »

If I understood correctly your post (and the little documentation I skimmed over), there is no way to control the volume for USB sound devices. They come with their own volume knob

Is there a way to identify that the user is using USB so I can gray out (disable) the volume instead of "failing graciously" ?

I could still show a hint telling the user that it seems that they are using a USB sound device which may have its own volume knowb.

Is there a particular module I should be looking for with lsmod? is there something to check under /proc or /dev ?
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

John Doe
Posts: 1681
Joined: Mon 01 Aug 2005, 04:46
Location: Michigan, US

#7 Post by John Doe »

Hey, I went crazy all afternoon and made it work (*edited previous code) :-)

At least with my device, the regex might not work for some people (grep regex syntax limitations really annoyed me).

*edit, I beefed up the regex by using the tcl object. I think it will handle things better now. People will need to test, report and possibly post the information I did below if it isn't working for them. Fixes can be made from there.

Here is further clarification on the issue. The main problem turns out to be that the snd-usb-audio driver doesn't support the SOUND_MIXER_VOLUME (0) channel, it DOES support the SOUND_MIXER_MIC (7) channel which I thought was odd. So the code now basically tries setvol first and, if it fails because that channel isn't present, tries to use amixer instead.

This is my output for amixer with the usb device:

Code: Select all

Simple mixer control 'Mic',0
  Capabilities: pvolume pvolume-joined cvolume pswitch pswitch-joined cswitch cswitch-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: Playback 0 - 32 Capture 0 - 16
  Mono: Playback 0 [0%] [off] Capture 0 [0%] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 38
  Mono:
  Front Left: Playback 10 [26%] [on]
  Front Right: Playback 10 [26%] [on]
sh-3.00#
[/b]

bobble991
Posts: 10
Joined: Tue 22 May 2007, 17:34
Location: Scotland

#8 Post by bobble991 »

ok this worked great for me, I can play music no problems BUT no system sounds. If I try to use setvol it says cant access /dev/mixer and to chmod it. It doesnt make any difference if I do. The alsa wizard doesnt see my usb card either which is odd because I use the alsa driver in gxine and that works fine. output from amixer is

Simple mixer control 'PCM',0
Capabilities pvolume pvolume-joined cvolume pswitch pswitch-joined
Playback channels: Mono
Capture channels:mono
Limits playback 0 - 100 Capture 0 - 15
Mono: Playback 100 [100%] [on] Capture 0 [0%]



Thats it. Any ideas?

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#9 Post by Flash »

bobbie, what version of Puppy are you using, and how? (Is it installed to hard drive? Full install or frugal?)

bobble991
Posts: 10
Joined: Tue 22 May 2007, 17:34
Location: Scotland

#10 Post by bobble991 »

Ive been gently upgrading and am currently on 2;15ce Its a full hard drive install with about eleven gig free. The sound card is a sound blaster live external 24 bit.

Thanks
Bob

Post Reply