Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 162292 Details for
Bug 234005
sys-apps/ivman-0.6.14 — patch to support condition detail matching
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
condition detail matching
ivman-0.6.14-conditionValue.diff (text/plain), 7.10 KB, created by
Michał Górny
on 2008-08-05 19:32:30 UTC
(
hide
)
Description:
condition detail matching
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2008-08-05 19:32:30 UTC
Size:
7.10 KB
patch
obsolete
>diff -dupr ivman-old/AUTHORS ivman-0.6.14/AUTHORS >--- ivman-old/AUTHORS 2004-05-25 09:48:27.000000000 +0200 >+++ ivman-0.6.14/AUTHORS 2008-08-04 21:23:07.628004899 +0200 >@@ -1,3 +1,5 @@ > Written by Ikke - http://www.eikke.com > > Code inspired by Gnome Volume Manager by RML and others >+ >+Condition detail matching added by MichaŠGórny, http://mgorny.jogger.pl/ >diff -dupr ivman-old/IvmConfigConditions.xml.5 ivman-0.6.14/IvmConfigConditions.xml.5 >--- ivman-old/IvmConfigConditions.xml.5 2005-11-12 03:47:23.000000000 +0100 >+++ ivman-0.6.14/IvmConfigConditions.xml.5 2008-08-04 21:16:51.428004299 +0200 >@@ -40,7 +40,7 @@ file is: > .br > <ivm:Condition name="conditionname1" exec="command1" /> > .br >- <ivm:Condition name="conditionname1" exec="command1" /> >+ <ivm:Condition name="conditionname2" value="conditionvalue2" exec="command2" /> > .br > </ivm:Match> > >@@ -51,8 +51,8 @@ file is: > > Each time a condition is emitted by a device, this file will be parsed. If the > Match rule matches the device on which the condition came from, and the Condition >-rule matches the name of the condition which occurred, then the command specified in >-the 'exec' option will be executed. >+rule matches the name (and value, if specified) of the condition which occurred, >+then the command specified in the 'exec' option will be executed. > > A Match element can have any of the following names: > .RS 5 >@@ -77,6 +77,10 @@ Condition names usually take the form of > button is pressed on your machine. See the HAL specification for a full list of > possible conditions. > >+Some conditions may also have a value, which supplies some additional info >+about event occured. For example, keyboard-emitted 'ButtonPressed' may have >+values like 'sleep', 'power' and 'wake-up'. >+ > The > .B exec > attributes of Condition tags support substitution of HAL device properties. >diff -dupr ivman-old/README ivman-0.6.14/README >--- ivman-old/README 2004-05-29 13:36:02.000000000 +0200 >+++ ivman-0.6.14/README 2008-08-04 21:23:50.176005019 +0200 >@@ -8,6 +8,7 @@ Who wrote it? > ------------- > Ivman was written by Ikke <eikke at users dot sourceforge dot org>, based on gnome-volume-manager, by Robert M. Love and others. > >+Conditional detail matching added by MichaŠGórny. > > Where can I find the latest information? > ---------------------------------------- >diff -dupr ivman-old/src/hal_interface.c ivman-0.6.14/src/hal_interface.c >--- ivman-old/src/hal_interface.c 2007-01-29 12:52:31.000000000 +0100 >+++ ivman-0.6.14/src/hal_interface.c 2008-08-04 21:09:59.037005779 +0200 >@@ -231,6 +231,9 @@ hal_device_condition(LibHalContext * ctx > __attribute__ ((__unused__))) > #endif > { >+#ifdef HAL_0_4 >+ const char *condition_detail = NULL; >+#endif > // VolumeUnmountForced occurs when USB disk is yanked or similar > // We have to ensure that device is removed from hash table > if (!strcmp(condition_name, "VolumeUnmountForced")) >@@ -245,7 +248,7 @@ hal_device_condition(LibHalContext * ctx > > char *file = ivm_get_config_file("IvmConfigConditions.xml"); > IvmConfigConditions *cfg = >- parseIvmConfigConditions(file, udi, condition_name); >+ parseIvmConfigConditions(file, udi, condition_name, condition_detail); > free(file); > > if (!cfg) >diff -dupr ivman-old/src/IvmConfig/IvmConfigConditions.c ivman-0.6.14/src/IvmConfig/IvmConfigConditions.c >--- ivman-old/src/IvmConfig/IvmConfigConditions.c 2005-11-21 16:27:17.000000000 +0100 >+++ ivman-0.6.14/src/IvmConfig/IvmConfigConditions.c 2008-08-04 21:09:59.041005739 +0200 >@@ -29,7 +29,9 @@ > IvmConfigConditions *parseIvmConfigConditions(char const *const path, > char const *udi, > char const *const >- conditionName) >+ conditionName, >+ char const *const >+ conditionValue) > { > gboolean mountable = ivm_device_is_mountable(udi); > >@@ -142,6 +144,7 @@ nextMatch: > else if (!xmlStrcmp(cur->name, (const xmlChar *) "Condition")) > { > xmlChar *name = xmlGetProp(cur, "name"); >+ xmlChar *value = xmlGetProp(cur, "value"); > > xmlChar *exec = xmlGetProp(cur, "exec"); > >@@ -151,7 +154,7 @@ nextMatch: > goto nextCondition; > } > >- if (!xmlStrcmp(name, (xmlChar *) conditionName)) >+ if (!xmlStrcmp(name, (xmlChar *) conditionName) && (!value || (conditionValue && !xmlStrcmp(value, (xmlChar *) conditionValue)))) > { > num_exec++; > ret->exec = realloc(ret->exec, >diff -dupr ivman-old/src/IvmConfig/IvmConfigConditions.h ivman-0.6.14/src/IvmConfig/IvmConfigConditions.h >--- ivman-old/src/IvmConfig/IvmConfigConditions.h 2005-05-12 03:42:34.000000000 +0200 >+++ ivman-0.6.14/src/IvmConfig/IvmConfigConditions.h 2008-08-04 21:09:59.041005739 +0200 >@@ -25,6 +25,7 @@ typedef struct IvmConfigConditions > char **exec; > } IvmConfigConditions; > >-IvmConfigConditions * parseIvmConfigConditions(char const * const path, char const * udi, char const * const conditionName); >+IvmConfigConditions * parseIvmConfigConditions(char const * const path, char const * udi, >+ char const * const conditionName, char const * const conditionValue); > > #endif >diff -dupr ivman-old/src/IvmConfig/IvmConfigConditions.xml ivman-0.6.14/src/IvmConfig/IvmConfigConditions.xml >--- ivman-old/src/IvmConfig/IvmConfigConditions.xml 2005-05-12 03:42:34.000000000 +0200 >+++ ivman-0.6.14/src/IvmConfig/IvmConfigConditions.xml 2008-08-04 21:22:06.284005099 +0200 >@@ -5,7 +5,7 @@ > > <ivm:Match name="matchname" value="matchvalue"> > <ivm:Condition name="conditionname1" exec="command1" /> >- <ivm:Condition name="conditionname2" exec="command2" /> >+ <ivm:Condition name="conditionname2" value="value2" exec="command2" /> > </ivm:Match> > > What does this actually mean? Well, when a device emits a condition, >@@ -13,6 +13,8 @@ > matches the name of the condition, then 'command1' will be > executed. > >+ If 'value' is set the condition detail will also have to match. >+ > Matches can be nested. See the examples. > > If a condition matches multiple times, all matching commands will be >@@ -36,11 +38,18 @@ > > <!-- Shut down when power button is pressed. This and the rest of the ACPI > stuff needs HAL 0.5 or better to work. Also, /sbin/shutdown needs to be >- in /etc/sudoers for whatever user Ivman runs as. --> >+ in /etc/sudoers for whatever user Ivman runs as. --> > <!-- > <ivm:Match name="hal.info.udi" value="/org/freedesktop/Hal/devices/acpi_PWRF"> > <ivm:Condition name="ButtonPressed" exec="/usr/bin/sudo /sbin/shutdown" /> > </ivm:Match> > --> > >+ <!-- Shut down on both frontpanel 'power' button and 'power' key on keyboard, >+ and hibernate on 'sleep' key. --> >+ <!-- >+ <ivm:Condition name="ButtonPressed" value="power" exec="/usr/bin/sudo /sbin/shutdown -h now"/> >+ <ivm:Condition name="ButtonPressed" value="sleep" exec="/usr/bin/sudo /usr/sbin/hibernate"/> >+ --> >+ > </ivm:ConditionsConfig>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 234005
: 162292 |
162293