delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / phonon / libkaudiodevicelist / soundcardinfo.sh
blob7e14ab0000cb60b2b3dc08711f40692b94101abc
1 #!/bin/sh
2 found_ids=""
3 all_entries=""
4 getId()
6 printf "%4s" `lshal -l -u "$1"|grep "$2 ="|cut -d"(" -f2|cut -d")" -f1|cut -dx -f2`|tr ' ' '0'
8 getNumber()
10 lshal -l -u "$1"|grep "$2 = "|cut -d"=" -f2|cut -d' ' -f2
12 getString()
14 lshal -l -u "$1"|grep "$2 ="|cut -d"'" -f2
17 createAlsaEntryFromHal()
19 subsystem=`getString "$2" "info\.subsystem"`
20 test -z "$subsystem" && subsystem=`getString "$2" "linux\.subsystem"`
21 vendor=`getString "$2" "$subsystem\\.vendor"`
22 product=`getString "$2" "$subsystem\\.product"`
23 vendor_id=`getId "$2" "$subsystem\\.vendor_id"`
24 product_id=`getId "$2" "$subsystem\\.product_id"`
25 pref=35
26 comment="$vendor $product"
27 if test "$subsystem" = "usb"; then
28 id="usb:$vendor_id:$product_id"
29 pref=$(($pref-10))
30 elif test "$subsystem" = "pci"; then
31 subsys_vendor=`getString "$2" "\\.subsys_vendor"`
32 subsys_vendor_id=`getId "$2" "\\.subsys_vendor_id"`
33 subsys_product_id=`getId "$2" "\\.subsys_product_id"`
34 id="pci:$vendor_id:$product_id:$subsys_vendor_id:$subsys_product_id"
35 comment="$comment $subsys_vendor"
37 alsa_device=`getNumber "$1" "alsa\\.device"`
38 id="$id:$3:alsa:$alsa_device"
39 if echo -e "$found_ids"|grep -q -v "$id"; then
40 found_ids="$found_ids $id"
41 card_id=`getString "$1" "alsa\\.card_id"`
42 device_id=`getString "$1" "alsa\\.device_id"`
43 comment="$comment $card_id $device_id"
44 if echo -e "$card_id $device_id"|grep -q -E -i "(spdif|s/pdif|iec958)"; then
45 pref=$(($pref-20))
47 all_entries="$all_entries\n# $comment\t[$id]\tname=$card_id ($device_id)\tinitialPreference=$pref\t"
48 echo -n "."
52 createOssEntryFromHal()
54 subsystem=`getString "$2" "info\.subsystem"`
55 test -z "$subsystem" && subsystem=`getString "$2" "linux\.subsystem"`
56 vendor=`getString "$2" "$subsystem\\.vendor"`
57 product=`getString "$2" "$subsystem\\.product"`
58 vendor_id=`getId "$2" "$subsystem\\.vendor_id"`
59 product_id=`getId "$2" "$subsystem\\.product_id"`
60 pref=20
61 comment="$vendor $product"
62 if test "$subsystem" = "usb"; then
63 id="usb:$vendor_id:$product_id"
64 pref=$(($pref-10))
65 elif test "$subsystem" = "pci"; then
66 subsys_vendor=`getString "$2" "\\.subsys_vendor"`
67 subsys_vendor_id=`getId "$2" "\\.subsys_vendor_id"`
68 subsys_product_id=`getId "$2" "\\.subsys_product_id"`
69 id="pci:$vendor_id:$product_id:$subsys_vendor_id:$subsys_product_id"
70 comment="$comment $subsys_vendor"
72 id="$id:both:oss"
73 if echo -e "$found_ids"|grep -q -v "$id"; then
74 found_ids="$found_ids $id"
75 card_id=`getString "$1" "oss\\.card_id"`
76 device_id=`getString "$1" "oss\\.device_id"`
77 comment="$comment $card_id $device_id"
78 if echo -e "$card_id $device_id"|grep -q -E -i "(spdif|s/pdif|iec958)"; then
79 pref=$(($pref-20))
81 all_entries="$all_entries\n# $comment\t[$id]\tname=$card_id ($device_id)\tinitialPreference=$pref\t"
82 echo -n "."
86 echo "/proc/asound/cards:"
87 cat /proc/asound/cards
88 echo -e "\n/proc/asound/pcm:"
89 cat /proc/asound/pcm
90 for card in `cat /proc/asound/cards|cut -c1-2`; do
91 num=0
92 codec="/proc/asound/card$card/codec#$num"
93 while test -e "$codec"; do
94 echo -e "\n$codec:"
95 cat "$codec"
96 num=$(($num+1))
97 codec="/proc/asound/card$card/codec#$num"
98 done
99 num=0
100 codec="/proc/asound/card$card/codec97#$num"
101 while test -d "$codec"; do
102 echo -e -n "\n$codec/ac97#"?-?
103 echo ":"
104 cat "$codec/ac97#"?-?
105 num=$(($num+1))
106 codec="/proc/asound/card$card/codec97#$num"
107 done
108 done
109 echo ""
110 alsaplayback=`lshal -s|grep _alsa_playback`
111 for playback_udi in $alsaplayback; do
112 card_udi="${playback_udi%_alsa_playback_*}"
113 card_udi="${card_udi%_sound_card_*}"
114 createAlsaEntryFromHal "$playback_udi" "$card_udi" "playback"
115 done
116 alsacapture=`lshal -s|grep _alsa_capture`
117 for capture_udi in $alsacapture; do
118 card_udi="${capture_udi%_alsa_capture_*}"
119 card_udi="${card_udi%_sound_card_*}"
120 createAlsaEntryFromHal "$capture_udi" "$card_udi" "capture"
121 done
122 oss=`lshal -s|grep _oss_pcm`
123 for udi in $oss; do
124 card_udi="${udi%_oss_pcm*}"
125 card_udi="${card_udi%_sound_card_*}"
126 createOssEntryFromHal "$udi" "$card_udi"
127 done
128 echo ""
129 echo -e "$all_entries"|sort|sed "s,\t,\n,g"