Sponsored Content
Operating Systems Linux udev rule + script for setting webcam's mic as audio input Post 302696329 by MojoDodo on Tuesday 4th of September 2012 08:02:50 PM
Old 09-04-2012
udev rule + script for setting webcam's mic as audio input

Hello,
whenever I plugin my webcam, I want to use its microphone instead of the one integrated in my laptop.
I therefore created a udev rule:
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="0807", RUN+="/usr/local/bin/webcammic"

This rule works, I've tested it with a testscript (the testscript works when I plugin my webcam).

For changing the microphone I use the following script.
Code:
#!/bin/bash
echo "set-default-source alsa_input.usb-046d_0807_83CCA370-02-U0x46d0x807.analog-mono" | pacmd

This works as well if I execute it in my comand line like this:
Code:
jo@jo-P53E:~$ sh /usr/local/bin/webcammic
Welcome to PulseAudio! Use "help" for usage information.

However udev seems to execute as root and therefore the script in combination with the udev rule doesn't work (→ nothing happens when I plug in my webcam).
I therefore changed the script to:
Code:
#!/bin/bash
su jo -c "echo \"set-default-source alsa_input.usb-046d_0807_83CCA370-02-U0x46d0x807.analog-mono\" | pacmd"

But if I plugin the webcam, nothing happens. If I execute the script in the command line, I get the following error:
Code:
jo@jo-P53E:~$ sh /usr/local/bin/webcammic
Passwort: 
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> Sessions still open, not unmounting
jo@jo-P53E:~$

Does anybody know what's wrong with my script or has any suggestions what to try else?
Thanks in advance!


Just for Information: I'm using Ubuntu 12.04
 

6 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

webcam on FreeBSD

Hello, guys ! I'm using FreeBSD 6.0-RELEASE. Can anyone recomend me a good soft that I can use for video conferences ? I mean, something like Yahoo! Messenger on Windows. I want to make a video conference with a friend of mine, but I use FreeBSD and my friend is using Windows. So, any sugestions... (1 Reply)
Discussion started by: Sergiu-IT
1 Replies

2. Shell Programming and Scripting

Simple BASH shell script to rename webcam jpg and copy into a new directory.

System: Ubuntu Intrepid Ibex I'm running webcamd as a sort of "security" program, but I need a script that will archive my webcam.jpg files. So, take the following file: /home/slag/www/webcam.jpg Rename it--preferably with a time stamp. Place it in say: /home/slag/www/history/ ... (4 Replies)
Discussion started by: robfindlay
4 Replies

3. Red Hat

set device mode permanently with udev rule

On a test server running CentOS 6, I try to permanently set the owner, group and mode of disk devices for use with a DB2 database. For this I created an udev rule file /etc/udev/rules.d/99-db2.rules: KERNEL=="sdb*", OWNER="db2usrl1", GROUP="db2adml1", MODE="0600" After a reboot, the owner and... (4 Replies)
Discussion started by: hergp
4 Replies

4. Shell Programming and Scripting

Script to delete files with an input for directories and an input for path/file

Hello, I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall: I regularly need to delete files from many directories. A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies

5. Slackware

Problems with audio recording in Audacity 2.0.5. Slackware64 14.1; Intel HD Audio.

I'm trying to record audio using Audacity 2.0.5 installed from SlackBuilds. My system is 64-bit Slackware 14.1 and a sound card is Intel HD Audio. I didn't change my sound system to OSS. (Default sound system in Slackware 14.1 is ALSA, isn't it?) First, I set Internal Microphone slider in KMix... (2 Replies)
Discussion started by: qzxcvbnm
2 Replies

6. Red Hat

Udev Rule TAG for identifying a local sas disk, non-scsi, non-fiber, non-iscsi

I need to add a VMware virtual disk to the 99-oracle-asmdevices.rules file but the OS is not assigning a WWID to the disk. It has been fdisk'd and a single partition created. What TAG inside the file needs to be added? the Program scsi-id does not work for some reason. latest patches... (0 Replies)
Discussion started by: mrmurdock
0 Replies
Locale::Script(3perl)					 Perl Programmers Reference Guide				     Locale::Script(3perl)

NAME
Locale::Script - standard codes for script identification SYNOPSIS
use Locale::Script; $script = code2script('phnx'); # 'Phoenician' $code = script2code('Phoenician'); # 'Phnx' $code = script2code('Phoenician', LOCALE_CODE_NUMERIC); # 115 @codes = all_script_codes(); @scripts = all_script_names(); DESCRIPTION
The "Locale::Script" module provides access to standards codes used for identifying scripts, such as those defined in ISO 15924. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 15924 four-letter codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying scripts. The ones currently supported are: alpha This is a set of four-letter (capitalized) codes from ISO 15924 such as 'Phnx' for Phoenician. This code set is identified with the symbol "LOCALE_SCRIPT_ALPHA". The Zxxx, Zyyy, and Zzzz codes are not used. This is the default code set. numeric This is a set of three-digit numeric codes from ISO 15924 such as 115 for Phoenician. This code set is identified with the symbol "LOCALE_SCRIPT_NUMERIC". ROUTINES
code2script ( CODE [,CODESET] ) script2code ( NAME [,CODESET] ) script_code2code ( CODE ,CODESET ,CODESET2 ) all_script_codes ( [CODESET] ) all_script_names ( [CODESET] ) Locale::Script::rename_script ( CODE ,NEW_NAME [,CODESET] ) Locale::Script::add_script ( CODE ,NAME [,CODESET] ) Locale::Script::delete_script ( CODE [,CODESET] ) Locale::Script::add_script_alias ( NAME ,NEW_NAME ) Locale::Script::delete_script_alias ( NAME ) Locale::Script::rename_script_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Script::add_script_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Script::delete_script_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes man page. SEE ALSO
Locale::Codes Locale::Constants http://www.unicode.org/iso15924/ Home page for ISO 15924. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 1997-2001 Canon Research Centre Europe (CRE). Copyright (c) 2001-2010 Neil Bowers Copyright (c) 2010-2011 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-09-26 Locale::Script(3perl)
All times are GMT -4. The time now is 03:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy