Sponsored Content
Top Forums Shell Programming and Scripting file seach from pulseaudio module list Post 302704327 by g8jvm on Friday 21st of September 2012 12:19:05 PM
Old 09-21-2012
file seach from pulseaudio module list

Hi Guys,I admit my knowledge in this area is awful, Smilie
I'm trying to get the alsa card number from within the text
returned by running
pactl list cards
Alsa card numbers from running aplay -l and above do not match.
I'm attempting to get a match on the PA card list with the type of sound card, and then once the card is found by matching "alsa.card ="n", where n is the card number with the alsa card number from aplay -l, which I have stored as a variable .
Then when the PA card is identified to get the module number.

The first few lines returned by "pactl list cards" are:-
Card #0
Name: alsa_card.pci-0000_00_1b.0
Driver: module-alsa-card.c
Owner Module: 4
Properties:
alsa.card = "0"

If it was all on the same line I could use grep, but I'm a bit stuck.

Could someone suggest a way of doing this and point me in the right direction please.

The end action from this is to unload a pulseaudio module, so there is no contention when running another app.

Thanks
Richard

---------- Post updated at 03:54 PM ---------- Previous update was at 03:21 PM ----------

Why is it when you ask for help, an alternative way is found !!
By using "pactl list short modules"
each module info is space delimited, which allows grep to be used,

ie
$ pactl list short modules|grep 'device_id'
4 module-alsa-card device_id="0" name="pci-0000_00_1b.0" card_name="alsa_card.pci-0000_00_1b.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes card_properties="module-udev-detect.discovered=1"

The wanted is the "4" at the start of the line .So awk can be piped to to get it.

On this laptop there is only one sound card, on the other there are four.

---------- Post updated at 04:19 PM ---------- Previous update was at 03:54 PM ----------

Sorry a bit more and I'm stuck again.
running
[richard@g8jvm ~]$ pactl list short modules|grep device_id= |awk '{print $1}'
4
5
6
7
this returns the four module IDs OK
BUT

running
pactl list short modules | grep device_id="0"|awk '{print $1}'

returns nothing, the correct value would be "4"

I'd like to replace the "0" with the variable $Hw, which is the
Alsa card number.

Not sure how to do this. any help appreciated
TIA
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Seach for Record

Below is an example of a file with some records... each record start with P1 till the next P1. If I search for something like "4,4545:" then I want all the records with "4,4545:" to be removed from original file and copied to a temp file. P1 1,123455654444 2,7126817361873 3,2134128282828... (5 Replies)
Discussion started by: xtravel
5 Replies

2. Linux

How to convert Linux Kernel built-in module into a loadable module

Hi all, I am working on USB data monitoring on Fedora Core 9. Kernel 2.6.25 has a built-in module (the one that isn't loadable, but compiles and links statically with the kernel during compilation) to snoop USB data. It is in <kernel_source_code>/drivers/usb/mon/. I need to know if I can... (0 Replies)
Discussion started by: anitemp
0 Replies

3. UNIX for Dummies Questions & Answers

Seach and Replace

Our email address is changing and I need to update 4000 htm pages. I was told I command was something like this Eg) find docs/700_799/ -name "*.htm" -type f | xargs perl -pi -e 's/\/company-information\/legal-and-regulatory/\/legal-and-regulatory/g' Is there away of not changing the date... (1 Reply)
Discussion started by: mchelle_99
1 Replies

4. UNIX for Dummies Questions & Answers

How do I list kernel module parameter values?

Hi, I have problem with parameter configuration. My question is after the configuration, how to check if successfully change the value or not? I saw someone has the same question, and followed his steps. Original thread:... (3 Replies)
Discussion started by: skybb
3 Replies

5. Shell Programming and Scripting

Seach for a string following a particular string in a file

All, I have a file like ; ... covers bhjl; ... khkjhk.. covers vjgj; .. bvjhy.. bkhk.. covers bjhk; Now I want to search all strings that follows covers and then write them in a new file. I want to use perl script for that. Output file should conatian: bhjl vjgj bjhk Regards... (8 Replies)
Discussion started by: Anamika08
8 Replies
OPENSC-TOOL(1)							   OpenSC Tools 						    OPENSC-TOOL(1)

NAME
opensc-tool - generic smart card utility SYNOPSIS
opensc-tool [OPTIONS] DESCRIPTION
The opensc-tool utility can be used from the command line to perform miscellaneous smart card operations such as getting the card ATR or sending arbitrary APDU commands to a card. OPTIONS
--atr, -a Print the Answer To Reset (ATR) of the card. Output is in hex byte format --card-driver driver, -c driver Use the given card driver. The default is auto-detected. --info, -i Print information about OpenSC, such as version and enabled components. --list-drivers, -D List all installed card drivers. --list-files, -f Recursively list all files stored on card. --list-readers, -l List all configured readers. --name, -n Print the name of the inserted card (driver). --reader num, -r num Use the given reader number. The default is 0, the first reader in the system. --send-apdu apdu, -s apdu Sends an arbitrary APDU to the card in the format AA:BB:CC:DD:EE:FF.... --serial Print the card serial number (normally the ICCSN). Output is in hex byte format --verbose, -v Causes opensc-tool to be more verbose. Specify this flag several times to enable debug output in the opensc library. --wait, -w Wait for a card to be inserted. SEE ALSO
opensc-explorer(1) opensc 06/17/2014 OPENSC-TOOL(1)
All times are GMT -4. The time now is 03:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy