Musings tagged as hardware

As a continuation of my previously posted Sennheiser GSX 1000 setup this is the followup which comes from a better understanding of pulseaudio and the device itself. First of all, the GSX 1000 exports three hardware devices. hw:1,0 and hw:1,1 as outputs as well as hw:1,0 as a microphone input. Regarding the outputs, hw:1,0 is actually the mono chat output that is mixed into the main 7.1 channel output by the GSX 1000. The offset from the main volume can be controlled with the small knob on the right side of the device. This makes it especially interesting for use with voice applications like mumble or teamspeak. Your friends are too loud or too low? Twist the knob and adjust on the fly. hw:1,1 is the main 7.1 channel output which - at the moment - does not get detected by pulseaudio as a 7.1 channel device which is why I wrote about the workaround in the previous post.

This new and updated solution should ease usability and possibly make this a copy and paste effort not depending on your system config. This new approach leverages udev in order to catch you plugging in your device and a special udev rule then sets an environmental variable to tell pulseaudio to use a different configuration file for the card. Also it sets a unique id so it is easier to reference the card in case you have more than one soundcard connected.

First of all you need to create a file 91-pulseaudio-gsx1000.rules in the directory /lib/udev/rules.d/ or wherever your udev stores its rules. In this file you put the following:

SUBSYSTEM!="sound", GOTO="pulseaudio_end"
ACTION!="change", GOTO="pulseaudio_end"
KERNEL!="card*", GOTO="pulseaudio_end"

ATTRS{idVendor}=="1395", ATTRS{idProduct}=="005e", ENV{PULSE_PROFILE_SET}="sennheiser-gsx-1000.conf", ATTR{id}="GSX1000"


LABEL="pulseaudio_end"

1395 is the id for the vendor Sennheiser and 005e is the GSX 1000. After that we set the environment variable for pulseaudio and the id attribute of the soundcard. Now you need to create a second (and last, I promise!) file name sennheiser-gsx-1000.conf in your pulseaudio profile sets directory. For me this goes into /usr/share/pulseaudio/alsa-mixer/profile-sets/sennheiser-gsx-1000.conf:
[General]
auto-profiles = no

[Mapping analog-output-surround71]
description = main output
device-strings = hw:CARD=GSX1000,DEV=1
#device-strings = hw:%f,1
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
paths-output = analog-output analog-output-lineout analog-output-speaker
priority = 2

[Mapping analog-output-chat]
description = chat output
device-strings = hw:CARD=GSX1000,DEV=0
#device-strings = hw:%f,0
channel-map = mono
paths-output = analog-output-headphones analog-output-headphones-2 analog-output-mono
priority = 1


[Mapping analog-input]
description = microphone input
device-strings = hw:CARD=GSX1000,DEV=0
#device-strings = hw:%f,0
channel-map = mono
paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headset-mic
priority = 2

# Combined output profile
[Profile output:analog-output-surround71+output:analog-output-chat+input:analog-input]
description = 7.1 Surround
output-mappings = analog-output-surround71 analog-output-chat
input-mappings = analog-input
priority = 88
skip-probe = yes

Now, all that is left is to reload udev, trigger the new ruleset and restart pulseaudio.

$> sudo udevadm control -R
$> sudo udevadm trigger
$> pulseaudio -k

After a couple of seconds pulseaudio should have restarted and you should have a nice and functional GSX 1000. Now, if someone has found a way to get software volume control working and how to keep the GSX from going Volume-Down all the time please tell me. :) Until then the temporary workaround for that problem remains unchanged and you can find it in the old article.

After a bit of a hiatus due to a new job engagement I am hopefully back on a more regular basis. For today with some instructions on getting a Sennheiser GSX1000 audio amplifier to run under Linux. This device is a 7.1 channel surround headphone amplifier with a lot of integrated extra functionality and a nice volume wheel. It connects via USB and there are a few steps to get it working correctly with pulseaudio. It does work right after plugging it in but only in mono mode which is not exactly what I bought this for. ;)

First of all let us get the ids of the sound card playback devices (sinks) via

$> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Audio [GSX 1000 Main Audio], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: Audio [GSX 1000 Main Audio], device 1: USB Audio [USB Audio #1]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

In my case, card 0 defaults to the HDMI output of my NVidia GPU, let us ignore those entries. Card 1 however is the Sennheiser GSX 1000. I am actually not 100% sure on why it is listed twice with the same subdevices. From trial and error I managed to find out that the subdevice 1 is the correct one to drive the unit. From this information we know that the hardware address of the card for playpack (sink) is 1,1 (card 1 subdevice 1). Next we have to find out the recording device (source).

$> arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Audio [GSX 1000 Main Audio], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Our recording device (source) is at the hardware address 1,0 (card 1 subdevice 0 - as there is only one anyway). With this information we can tell pulseaudio how to correctly talk to our audio amplifier. Edit /etc/pulse/default.pa and under Load audio drivers statically we add

load-module module-alsa-sink device=hw:1,1 channels=8
load-module module-alsa-source device=hw:1,0

The first line tells pulseaudio that the playback device (sink) is located at hardware address 1,1 and has 8 (7+1) channels. The second line defines our recording device (source) as hardware address 1,0. At this point you can either restart your pulseaudio with pulseaudio -k or opt for a reboot if you still have not shaken your Windows heritage. ;) Voilla, it works!

The only problem left for me was that the turning of the volume ring gets detected by the kernel as volume down no matter the direction you turn the know. As such I went into the keyboard shortcut settings and disabled the multimedia hotkeys for volume up and volume down. I don’t mind losing that functionality as I want to set the master volume via the GSX1000 wheel anyway. After this small fix I can just use the hardware functionality of the volume wheel as supposed to and that leaves me one happy Alex ^^.

Update: I have found a more elegant way to handle this device. Check out the followup!

In a seriously unpopular move, smartphone maker Huawei disclosed that they will stop offering unlock codes for their devices’ bootloaders. They say they want to

[…] deliver the best user experience and prevent users from experiencing possible issues that could arise from ROM flashing […]

As in: digital self-determination, full control over the devices that you paid for, removal of bloatware, or just the general freedom to mess around with stuff that you own. This is definately a reason to no longer buy Huawei devices. Manufacturers that want to dictate how you use your device should not be supported at all. Reddit and Twitter are apparently already loaded with Huawei customers that are announcing to return their most recent Huawei merchandise in order to move to more open brands.

In the end I think that we urgently need laws prohibiting hardware manufacturers from locking down their systems. If you pay for it, the silicone should be yours to do with as you please. Of course, if you brick the device in the process, it is your own damn fault. So no suing of hardware manufacturers because you decided it was a good idea to yank out the data cable while flashing a new rom! But you should have the right to do whatever you want to your devices.

This is actually the same reason why I would never ever buy an iPhone. I am the one telling my phone what to install, what to load, and what to execute, not the other way around.

Richard, a longtime maintainer for various open source projects, has offered Razor to do their dirty work for them and write firmware update software from scratch so Linux users that want to update their Razer devices without having to install Windows first can do so. All he asked for was some example code or at least the specifications so he could get started.

I offered to upstream any example code they could share under a free license, or to write the code from scratch given enough specifications to do so. This is something I’ve done for other vendors, and doesn’t take long as most vendor firmware updaters all do the same kind of thing; there are only so many ways to send a few kb of data to USB devices.

So how did Razer respond to the gift horse? I mean, they would be fools to turn down an offer of someone expanding their potential customer base for free, right?

I have discussed your offer with the dedicated team and we are thankful for your enthusiasm and for your good idea. I am afraid I have also to let you know that at this moment in time our support for software is only focused on Windows and Mac.

So don’t buy Razer hardware if you want to maintain them without a proprietary operating system. Personally I have never been a big fan of Razer as their desire to put everything into the cloud has taken one hillarious turn after the other. I’m sorry but my mouse settings do not need to be stored in the cloud and I do not want to create an account with your site just to use a piece of hardware I already paid for.

1