[alsa-devel] S51 usb support
Hmm, there is no feature unit in this dump, so the volume is most probably set with an vendor-specific USB request. Unless the Windows driver does something similar than PulseAudio and handles the volume level control in software (iow, modify each sample before sending it to the hardware) rather than setting any actual hardware volume level.
Daniel, you are right, Its the driver thing. Feb 2009, I was dealing this the same issue and James Courtier-Dutton from this list pointed out that the device has no hardware based mixer controls which is why alsamixer does not find anything. He suggested using SoftVol.
I've been using dmix and Softvol for volume control whenever I need it. This is the ~/.asoundrc I use http://mndar.phpnet.us/usbxfi/files/asoundrc.log
The device has a volume knob. I had left the issue of the volume knob alone until a few days back..
I was about the post this when I came across the query from Matti Picus.
This is how it works. The volume knob sends an interrupt via endpoint 0x83 containing 0xC0 0x00 whenever it is rotated clockwise,anti-clockwise or pressed. After this a control message is sent to the device to retrieve which of the 3 actions it was. The control packet sent is 0xa1 0x85 0x00 0x00 0x00 0x00 0x04 0x00 We get a 1 byte response. 0x0F for anti-clockwise rotation. 0x0D for press and 0x10 for clockwise rotation.
I've tested this using a simple kernel module to handle just the volume knob and it works fine. The quick little code I've written does the above, then sets a sysfs attribute and sends a kobject_uevent. Udev rules execute a command depending on the value of this sysfs attribute. (Having some issues here but anyway...)
Since the volume is entirely a software thing, I figure this might be a good way of letting userspace know about the volume knob. Using softvol we can have a Master volume control and then we can use a command like amixer in udev rules to change the volume. Or since events are passed to HAL, something could be done there.
I do not know much about the usbaudio driver but does this seem like something that can be done from within the usbaudio driver ?
-Mandar Joshi
On Wed, Oct 20, 2010 at 8:30 PM, Mandar Joshi emailmandar@gmail.com wrote:
This is how it works. The volume knob sends an interrupt via endpoint 0x83 containing 0xC0 0x00 whenever it is rotated clockwise,anti-clockwise or pressed. After this a control message is sent to the device to retrieve which of the 3 actions it was. The control packet sent is 0xa1 0x85 0x00 0x00 0x00 0x00 0x04 0x00 We get a 1 byte response. 0x0F for anti-clockwise rotation. 0x0D for press and 0x10 for clockwise rotation.
Seems the functionality to handle the endpoint and retrieve the action is already present in snd-usb-audio Just had to add an entry specific to USB X-Fi to mixer_quirks.c I tested this with alsa-driver 1.0.23. Compiled it with debug. You can see the received code in /var/log/messages 0x0F for anticlockwise rotation. 0x0D for press and 0x10 for clockwise rotation
Of course since there is no hardware mixer, the volume won't change. This received code needs to be communicated to userspace. Any Suggestions?
Here is the addition I've tested
diff -rupN alsa-driver-1.0.23.orig/alsa-kernel/usb/mixer_quirks.c alsa-driver-1.0.23/alsa-kernel/usb/mixer_quirks.c --- alsa-driver-1.0.23.orig/alsa-kernel/usb/mixer_quirks.c 2010-04-16 11:10:10.000000000 +0000 +++ alsa-driver-1.0.23/alsa-kernel/usb/mixer_quirks.c 2010-10-22 10:45:22.000000000 +0000 @@ -61,6 +61,7 @@ static const struct rc_config { { USB_ID(0x041e, 0x3020), 2, 1, 6, 6, 18, 0x0013 }, /* Audigy 2 NX */ { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ + { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi */ };
static void snd_usb_soundblaster_remote_complete(struct urb *urb) @@ -75,7 +76,7 @@ static void snd_usb_soundblaster_remote_ code = mixer->rc_buffer[rc->offset]; if (rc->length == 2) code |= mixer->rc_buffer[rc->offset + 1] << 8; - + snd_printd(KERN_DEBUG "remote code: %02X\n",code); /* the Mute button actually changes the mixer control */ if (code == rc->mute_code) snd_usb_mixer_notify_id(mixer, rc->mute_mixer_id);
On Fri, Oct 22, 2010 at 5:14 AM, Mandar Joshi emailmandar@gmail.com wrote:
Just had to add an entry specific to USB X-Fi to mixer_quirks.c I tested this with alsa-driver 1.0.23. Compiled it with debug. You can see the received code in /var/log/messages 0x0F for anticlockwise rotation. 0x0D for press and 0x10 for clockwise rotation
Of course since there is no hardware mixer, the volume won't change. This received code needs to be communicated to userspace. Any Suggestions?
Here is the addition I've tested
diff -rupN alsa-driver-1.0.23.orig/alsa-kernel/usb/mixer_quirks.c alsa-driver-1.0.23/alsa-kernel/usb/mixer_quirks.c --- alsa-driver-1.0.23.orig/alsa-kernel/usb/mixer_quirks.c 2010-04-16 11:10:10.000000000 +0000 +++ alsa-driver-1.0.23/alsa-kernel/usb/mixer_quirks.c 2010-10-22 10:45:22.000000000 +0000 @@ -61,6 +61,7 @@ static const struct rc_config { { USB_ID(0x041e, 0x3020), 2, 1, 6, 6, 18, 0x0013 }, /* Audigy 2 NX */ { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */
- { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi */
};
static void snd_usb_soundblaster_remote_complete(struct urb *urb) @@ -75,7 +76,7 @@ static void snd_usb_soundblaster_remote_ code = mixer->rc_buffer[rc->offset]; if (rc->length == 2) code |= mixer->rc_buffer[rc->offset + 1] << 8;
- snd_printd(KERN_DEBUG "remote code: %02X\n",code);
/* the Mute button actually changes the mixer control */ if (code == rc->mute_code) snd_usb_mixer_notify_id(mixer, rc->mute_mixer_id);
This works fine with the alsa_usb driver in lirc. The code is received is being handled by Creative USB IR receiver devices config in /etc/lircd.conf So just adding
{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi */
to mixer_quirks.c is enough to get the volume knob working with Lirc.
Should I submit a patch for that?
-Mandar Joshi
participants (1)
-
Mandar Joshi