User Tools

Site Tools


linux:linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:linux [2017/06/07 16:54]
cipibad created
linux:linux [2017/06/07 17:22] (current)
cipibad
Line 16: Line 16:
 </​code>​ </​code>​
  
-====== usb headphone ======+====== usb headphone ​(Jabra) ​======
   - find device ​   - find device ​
-''​cbadescu@cbadescu-ubuntu64:​~$ find /dev | grep -i jabra | grep snd /​dev/​snd/​by-id/​usb-GN_Audio_A_S_Jabra_EVOLVE_30_II_0002AD72CD6E07-00''​+<​code>​ 
 +$ find /dev | grep -i jabra | grep snd /​dev/​snd/​by-id/​usb-GN_Audio_A_S_Jabra_EVOLVE_30_II_0002AD72CD6E07-00 
 + 
 +</​code>​
   - find attributes   - find attributes
 +<​code>​
 +$ udevadm info -a -n /​dev/​snd/​by-id/​usb-GN_Audio_A_S_Jabra_EVOLVE_30_II_0002AD72CD6E07-00
 +Udevadm info starts with the device specified by the devpath and then
 +walks up the chain of parent devices. It prints for every device
 +found, all possible attributes in the udev rules key format.
 +A rule to match, can be composed by the attributes of the device
 +and the attributes from one single parent device.
 +
 +  looking at device '/​devices/​pci0000:​00/​0000:​00:​14.0/​usb3/​3-1/​3-1.1/​3-1.1:​1.0/​sound/​card1/​controlC1'​
 +:
 +    KERNEL=="​controlC1"​
 +    SUBSYSTEM=="​sound"​
 +    DRIVER==""​
 +
 +  looking at parent device '/​devices/​pci0000:​00/​0000:​00:​14.0/​usb3/​3-1/​3-1.1/​3-1.1:​1.0/​sound/​card1':​
 +
 +    KERNELS=="​card1"​
 +    SUBSYSTEMS=="​sound"​
 +    DRIVERS==""​
 +    ATTRS{id}=="​II"​
 +    ATTRS{number}=="​1"​
 +
 +  looking at parent device '/​devices/​pci0000:​00/​0000:​00:​14.0/​usb3/​3-1/​3-1.1/​3-1.1:​1.0':​
 +    KERNELS=="​3-1.1:​1.0"​
 +    SUBSYSTEMS=="​usb"​
 +    DRIVERS=="​snd-usb-audio"​
 +    ATTRS{authorized}=="​1"​
 +    ATTRS{bAlternateSetting}=="​ 0"
 +    ATTRS{bInterfaceClass}=="​01"​
 +    ATTRS{bInterfaceNumber}=="​00"​
 +    ATTRS{bInterfaceProtocol}=="​00"​
 +    ATTRS{bInterfaceSubClass}=="​01"​
 +    ATTRS{bNumEndpoints}=="​00"​
 +    ATTRS{supports_autosuspend}=="​1"​
 +
 +  looking at parent device '/​devices/​pci0000:​00/​0000:​00:​14.0/​usb3/​3-1/​3-1.1':​
 +    KERNELS=="​3-1.1"​
 +    SUBSYSTEMS=="​usb"​
 +    DRIVERS=="​usb"​
 +    ATTRS{authorized}=="​1"​
 +    ATTRS{avoid_reset_quirk}=="​0"​
 +    ATTRS{bConfigurationValue}=="​1"​
 +    ATTRS{bDeviceClass}=="​00"​
 +    ATTRS{bDeviceProtocol}=="​00"​
 +    ATTRS{bDeviceSubClass}=="​00"​
 +    ATTRS{bMaxPacketSize0}=="​8"​
 +    ATTRS{bMaxPower}=="​100mA"​
 +    ATTRS{bNumConfigurations}=="​1"​
 +    ATTRS{bNumInterfaces}=="​ 4"
 +    ATTRS{bcdDevice}=="​0203"​
 +    ATTRS{bmAttributes}=="​80"​
 +    ATTRS{busnum}=="​3"​
 +    ATTRS{configuration}==""​
 +    ATTRS{devnum}=="​37"​
 +    ATTRS{devpath}=="​1.1"​
 +    ATTRS{idProduct}=="​0313"​
 +    ATTRS{idVendor}=="​0b0e"​
 +    ATTRS{ltm_capable}=="​no"​
 +    ATTRS{manufacturer}=="​GN Audio A/S"
 +    ATTRS{maxchild}=="​0"​
 +    ATTRS{product}=="​Jabra EVOLVE 30 II"
 +    ATTRS{quirks}=="​0x0"​
 +    ATTRS{removable}=="​unknown"​
 +    ATTRS{serial}=="​0002AD72CD6E07"​
 +    ATTRS{speed}=="​12"​
 +    ATTRS{urbnum}=="​97635"​
 +    ATTRS{version}=="​ 2.00"
 +
 +.....
 +</​code>​
 + - create udev rules file (''/​etc/​udev/​rules.d/​90-jabra.rules''​) similar to the one bellow (replace ​
 +**ionescu** with your username)
 +<​code>​
 +KERNEL=="​controlC1",​ SUBSYSTEM=="​sound",​ ACTION=="​add",​ ATTRS{product}=="​Jabra EVOLVE 30 II", RUN+="
 +/​home/​ionescu/​bin/​jabra_wrapper.sh"​
 +</​code>​
 + - create /​home/​ionescu/​bin/​jabra_wrapper.sh file
 +<​code>​
 +#!/bin/sh
 +
 +/​usr/​bin/​nohup /bin/su ionescu -c /​home/​ionescu/​bin/​jabra.sh >/​dev/​null 2>&1 </​dev/​null &
 +</​code>​
 + - create /​home/​ionescu/​bin/​jabra.sh file
 +<​code>​
 +#!/bin/sh
 +
 +PULSE_SERVER="​unix:/​run/​user/​`id -u`/​pulse/​native"​
 +
 +SINK_NAME="​alsa_output.usb-GN_Audio_A_S_Jabra_EVOLVE_30_II_0002AD72CD6E07-00.analog-stereo"​
 +
 +SINK_LIST_CMD="​pactl --server $PULSE_SERVER list sinks"
 +
 +nSinks=`$SINK_LIST_CMD | grep "Name: $SINK_NAME"​ | wc -l`
 +tries=0
 +MAX_TRIES=10
 +
 +while [ $nSinks -ne 1 -a $tries -lt $MAX_TRIES ]; do
 +    nSinks=`$SINK_LIST_CMD | grep "Name: $SINK_NAME"​ | wc -l`
 +    tries=$((tries+1))
 +    sleep 1
 +done
 +
 +pactl --server "​$PULSE_SERVER"​ set-default-sink alsa_output.usb-GN_Audio_A_S_Jabra_EVOLVE_30_II_0002AD72CD6E07-00
 +.analog-stereo
 +</​code>​
 + - make the two new files executable
 +<​code>​
 +$ chmod +x /​home/​ionescu/​bin/​jabra.sh /​home/​ionescu/​bin/​jabra_wrapper.sh
 +</​code>​
 + - double check and adapt to your environment (username/​sink name/etc.)
linux/linux.1496843652.txt.gz · Last modified: 2017/06/07 16:54 by cipibad