first stupid try for a rule compose gui
PATCH 1/1 first stupid try for a rule compose gui
Here is a first simple and pretty stupid try to make a simple tool for composing of a udev rule.
It reads the udevdb to get all currently handled devices and presents a list, where you can choose the device to compose the rule for.
The composed rule is just printed out in a window, nothing else by now.
Do we want something like this?
Nevermind, I always wanted to know, how this newt thing works :)
thanks,
Kay
Makefile +7 -2
@@ -36,6 +36,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart +RULER = udevruler VERSION = 021_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION)
@@ -175,7 +176,7 @@ CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) +all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(RULER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \
@@ -294,10 +295,14 @@ $(LD) $(LDFLAGS) -o $@ $(CRT0) udevstart.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ +$(RULER): $(RULER).o $(OBJS) $(HEADERS) $(LIBC) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt + $(STRIPCMD) $@ + clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) $(RULER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \
udevruler.c new file +407 -0
407 lines not on this page · raw message
Quoted 10 lines · Kay Sievers
Here is a first simple and pretty stupid try to make a simple tool for composing of a udev rule.
It reads the udevdb to get all currently handled devices and presents a list, where you can choose the device to compose the rule for.
The composed rule is just printed out in a window, nothing else by now.
Do we want something like this?
Nevermind, I always wanted to know, how this newt thing works :)
Here is the next step, I still can't sleep and there are to many patches pending to make something useful :)
Cause nobody wanted to play with me, I've made a screenshot. The device list is sorted in alphabetical order now and if there are only a few recently discovered devices, they are placed on top of the list.
For those who want to have a look:
http://vrfy.org/projects/udev/udevruler.png
The patch applies on top of today's mmap() patch. The db format is changed to have the file and line number of the applied rule. So it should be easy to edit the matching rule with this beast. It compiles with "make all udevruler".
thanks,
Kay
Makefile +6 -1
@@ -36,6 +36,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart +RULER = udevruler VERSION = 021_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION)
@@ -296,10 +297,14 @@ $(LD) $(LDFLAGS) -o $@ $(CRT0) udevstart.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ +$(RULER): $(RULER).o $(OBJS) $(HEADERS) $(LIBC) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt + $(STRIPCMD) $@ + clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) $(RULER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \
namedev.c +5 -0
@@ -840,6 +840,8 @@apply_format (udev, udev->name,sizeof (udev->name), class_dev, sysfs_device);apply_format (udev, udev->symlink,sizeof (udev->symlink), class_dev, sysfs_device); udev->partitions = dev->partitions; +strfieldcpy (udev->config_file, dev->config_file); + udev->config_line = dev->config_line; done:/* get permissions given in rule */
@@ -861,6 +863,9 @@dbg ("name, '%s' is going to have owner='%s', group='%s', mode = %#o" , udev->name, udev->owner, udev->group, udev->mode); + +/* store time of action */ + udev->config_time =time (NULL );return 0 ; }
udev.h +3 -0
@@ -50,6 +50,9 @@unsigned int mode;/* not mode_t due to conflicting definitions in different libcs */ char symlink[NAME_SIZE ];int partitions; +int config_line; +char config_file[NAME_SIZE ]; +time_t config_time;/* private data that help us in building strings */ char bus_id[SYSFS_NAME_LEN ];
udevinfo.c +3 -0
@@ -112,6 +112,9 @@printf ("S: %s\n" , dev->symlink);printf ("O: %s\n" , dev->owner);printf ("G: %s\n" , dev->group); +printf ("F: %s\n" , dev->config_file); +printf ("L: %i\n" , dev->config_line); +printf ("T: %li\n" , dev->config_time);printf ("\n" );return 0 ; }
udevruler.c new file +503 -0
503 lines not on this page · raw message
Greg KH
AppliedQuoted 18 lines · Kay Sievers
Quoted 10 lines · Kay Sievers
Here is a first simple and pretty stupid try to make a simple tool for composing of a udev rule.
It reads the udevdb to get all currently handled devices and presents a list, where you can choose the device to compose the rule for.
The composed rule is just printed out in a window, nothing else by now.
Do we want something like this?
Nevermind, I always wanted to know, how this newt thing works :)Here is the next step, I still can't sleep and there are to many patches pending to make something useful :)
Cause nobody wanted to play with me, I've made a screenshot. The device list is sorted in alphabetical order now and if there are only a few recently discovered devices, they are placed on top of the list.
Quoted 8 lines
For those who want to have a look:
http://vrfy.org/projects/udev/udevruler.png
The patch applies on top of today's
mmap()patch. The db format is changed to have the file and line number of the applied rule. So it should be easy to edit the matching rule with this beast. It compiles with "make all udevruler".
Nice, I've had some people ask me about a gui like tool. This is a great first step.
Applied, thanks.
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel