Lighweight pup_event_frontend_d Replacement

Under development: PCMCIA, wireless, etc.
Message
Author
jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#21 Post by jamesbond »

Karl Godt wrote:142 complains about trigger: unrecognized option `--sysname-match='
Your udev must be of an older version. I tried to google to find the equivalent options for older udev, but it seems that all those options have been eradicated. What is your udev version? Perhaps we can figure it out by looking at the source (assuming the source is still available from kernel.org).
what works is something like udevadm trigger /block/sda
That's not good because without the correct command line, udev will issue "change" event to *ALL* devices.
Looking good so far . Just needs the Icons :)
:)
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#22 Post by Karl Godt »

kernel.org became a scattered pile of dung since the attack some two years ago ( patch* es missing ) and now they out-source files as it seems .

From memory I knew there had been problems to compile udev between 140 and 150 on Pup-43* .

151 gives me

1) configure:12380: error: gperf is needed
2) --disable-extras > Package gobject-introspection-1.0 was not found in the pkg-config search path.
3) configure:12565: error: libacl not found
Your udev must be of an older version
142
That's not good
But funny ;)

Puppy Lupu 5 has udevd --version 124 as it seems. Still runs well also on my machines.
Just needs the Icons Smile
Turns out to be a horror. Since
<Path>/sbin/mount-and-open</Path>
is everywhere the same, rox's globicons file seems to pick one icon for mounted, mounted_boot and unmounted .
un 8)
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#23 Post by mavrothal »

Karl Godt wrote: 1) configure:12380: error: gperf is needed
2) --disable-extras > Package gobject-introspection-1.0 was not found in the pkg-config search path.
3) configure:12565: error: libacl not found
You can not compile udev with acl/xattr support in frugal installs.
Aufs does not support acl/xattr. You must have either a full puppy install (one of the reasons that BK usually compiles from full installs) or compile udev without acl support.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#24 Post by Iguleder »

musher0 wrote:Where do these utilities go? Alternately, would a *.pet be useful?
Just put everything in /usr/bin,

If I find the time, I'll fix the icon and placement issues, then make a PET.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#25 Post by charlie6 »

Hi Iguleder,
(running wheez-3.5.2.5)
also thanks for your time doing all this, as also to other contributors !

I got a try on these part-hotplug-handler.tar.bz2 but it seems not yet solve the following:

Here using several USB memory plugs, and external hard disk disk, to save datas, lets call them sdb1, sdc1, sdd1 to 10. All plugged into a 4 ports USB hub.
Some daily used apps (textprocessor, spreadsheet, etc...) keep tracks of the recent used files.
I am using those trasks as hints to get a fast access to my datas.

Sometimes i have to unplug one of them - for instance sdc1 - (after having unmounted it... :wink: ), and aftrwds to plug another one, and aftrwds, to re-plugs the former.

This last one is no longer named sdc1, but sde1 instead. Sometimes all USB drive icons switch off, and redisplay whith names like sde1, sdf1, sdg1 ...

The only workaround to get back to sdb1, sdc1, sdd1 ... configuration is ... to shutdown the PC and reboot. Restart X does NOT help.

I have browsed across the forum since months (even years...) whithout finding how to fix this nor understanding what could explain this.

I figure out this is as if the initial USB keys names where stored somewhere ... without resetting upon unplugging.

Having installed and compiled part-hotplug-handler, a possible workaround i found:
when opened Rox file manager to /mnt, all mounted drives are displayed with a green dot.
Some already unplugged USB plugs still display with a green dot (YESSS ... :shock: ! ) as if they were currently plugged :shock: ! Right clicking on them and unmounting them result in a kind of reset of the , let's call it so, «usb-plugs-map».

Thanks again for any answer, Charlie

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#26 Post by Iguleder »

You'll have to configure udev, so it uses persistent device names. Take a look at /etc/udev.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#27 Post by charlie6 »

Thanks Iguleder,
Iguleder wrote:You'll have to configure udev, so it uses persistent device names. Take a look at /etc/udev.
how can one configure udev? Here /etc/udev is a folder which has udev.conf and udev.rules in it.

I again got a try using part-hotplug-handler putting it in /usr/bin (with pup_event_frontend_d just disabled).
Got the following comments in terminal:
./part-hotplug-handler seems hanging up till i do Ctrl-c to stop it.
./mount-and-open can't find /mnt/ in /etc/fstab or /etc/mtab
sh-3.00# ./part-hotplug-handler
^C
sh-3.00# ./part-hotplug-handler --help
^C
sh-3.00# ldd part-hotplug-handler
linux-gate.so.1 => (0xffffe000)
libudev.so.0 => /lib/libudev.so.0 (0xb7755000)
libc.so.6 => /lib/libc.so.6 (0xb7607000)
librt.so.1 => /lib/librt.so.1 (0xb75fd000)
/lib/ld-linux.so.2 (0xb7765000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb75e4000)
sh-3.00# ./part-icon
sh-3.00# ./mount-and-open
BusyBox v1.19.3 (2011-11-09 07:34:50 WST) multi-call binary.

Usage: basename FILE [SUFFIX]

Strip directory path and .SUFFIX from FILE


mount: can't find /mnt/ in /etc/fstab or /etc/mtab
sh-3.00#
Moreover, or, as a consequence, i don't get any icon on desktop.

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#28 Post by jamesbond »

Karl Godt wrote:
jamesbond wrote:Your udev must be of an older version
Karl wrote:142
You don't need to re-compile that, I just want to grab the source so I can see what options are provided by that particular version. Yes, your udev is way too old - 142 doesn't support triggering by device names (or any subset of devices, unless you already know what you're looking for - yuck!), so all you can do is to re-trigger the events like this:

Code: Select all

udevadm trigger --action=add
or may be try

Code: Select all

udevadm trigger --action=change
and see if Iggy's code works. From here, you need to add your own filter in part-icon so only relevant block devices got shown (e.g. no loops, no rams, no nbds, no other virtual block device stuff).
Karl wrote:
Just needs the Icons Smile
Turns out to be a horror. Since
<Path>/sbin/mount-and-open</Path>
is everywhere the same, rox's globicons file seems to pick one icon for mounted, mounted_boot and unmounted .
uncool :(
That can be fixed in many ways, we can create symlink, or we can create rox apps, etc, again the fix is in part-icon.

I will leave that as an exercise for the reader :twisted:
charlie6 wrote:I have browsed across the forum since months (even years...) whithout finding how to fix this nor understanding what could explain this.
This is old, but the principle is still the same: http://www.reactivated.net/writing_udev_rules.html.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#29 Post by Karl Godt »

http://lmgtfy.com/?q=udev-142
:mrgreen:

Neverteheless have compiled udev-151

./configure --bindir=/bin --sbindir=/sbin --libexecdir=/usr/libexec --sysconfdir=/etc --localstatedir=/var --libdir=/lib --includedir=/usr/include --datarootdir=/usr/share --disable-introspection

successfully on Macpup511 in frugal mode with aufs layerfs , which had libacl ( or 511 devx ) .

udev-151 has --sysname-match parameter :)

Will have to recompile it with --libexecdir=/etc/udev :? .

udev-130 series defaults to /usr/local :IIRC:
udev-140 series defaults to / with the --sysconfdir=/usr/etc :Quite Ok:
udev-150 series defaults to /usr :twisted:

Was always wondering about the
if [ $UDEVVER -gt 150 ];then
#100611 v151 is recommended for kernel 2.6.27+.
lines in rc.sysinit
and found only version 124p420, 136w5 and 167w5 in the quirky/wary/puppy repos on ibiblio .

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#30 Post by Iguleder »

Guys - I created a Git repository for this project and cleaned it up a bit. Pull requests are appreciated, as long as the coding style is fine and the changes are tested.

The handler process doesn't create desktop icons - it mounts and runs the file manager instead. This is a Puppy modification we'll have to add.

akash_rawal - it seems select() is needed. udev_monitor_receive_device() does not block.

EDIT: it's pretty cool! Install the code in the repository and put the following in your .jwmrc:

Code: Select all

<StartupCommand>part-hotplug-monitor</StartupCommand>
Automatic mounting and unmounting works perfectly, although it could be insecure (if regular users are allowed to mount and unmount).
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#31 Post by Iguleder »

Good news!

I wrote a handler which creates desktop icons and lets ROX-Filer automatically position them, so they appear right after the existing ones. See the screeny for an example. This handler uses Puppy-style icons which match the partition type and change once the partition is mounted. The sources are attached :)

It's possible to use Puppy's icon positioning algorithm but it's quite dirty and I like it more when icons are automatically arranged.

First impressions? :D
Attachments
part-hotplug-handler.tar.bz2
(18.16 KiB) Downloaded 343 times
screeny.png
(47.37 KiB) Downloaded 461 times
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

simargl

#32 Post by simargl »

.
Last edited by simargl on Sun 01 Sep 2013, 15:13, edited 1 time in total.

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#33 Post by charlie6 »

Hi Iguleder,
here impressions on wheezy-3.5.2.5
- have extracted the part-hotplug-handler.tar.bz2
- have compiled part-hotplug-monitor.c > got part-hotplug-monitor (just ran make)
- have copied + rendered them executable
part-hotplug-monitor
part-hotplug-handler
part-icon
to /usr/bin
- have made a symlink for part-hotplug-monitor pointing to /sbin where /sbin/pup_event_frontend_d is present
- have disabled the existing pup_event_frontend_d and renamed whatever anme;
- have renamed pup_event_frontend_d the symling part-hotplug-monitor

restarted X ... wait a rather long long time till X actually restarted ... and got X desktop displayed without any drive icon.

running ./sbin/part-hotplug-monitor in a console: part-hotplug-monitor seems hanging up as there is no comment and nothing happens...

have i missed something ...?
Charlie

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#34 Post by Iguleder »

Yep, two things:
- It doesn't output anything.
- It still doesn't draw icons for existing partitions, only for newly added ones. :wink:
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#35 Post by jamesbond »

@charlie6
To display existing partitions you need to re-trigger udev. See my comment for Karl, in the previous page.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#36 Post by charlie6 »

@Iguleder & Jamesbond
:)
thanks for your help!
it works as expected ...how fast .. 8) ... and believe i will keep it for a while, even if some icons have falled outside the desktops bottom edge ... :shock:
see attached screenshot (wheezy-3.5.2.5 1280x1024 resolution)
installation:
all files placed in /usr/bin (after compilation !!)
+
symlinked /usr/bin/part-hotplug-monitor to /sbin/part-hotplug-monitor
+
disactivated /sbin/pup_event_frontend_d
+
renamed it /sbin/pup_event_frontend_d.txt
+
renamed the symlink /sbin/part-hotplug-monitor to /sbin/pup_event_frontend_d

Pmount helps for opening disk that are not displayed (red circled); sdb1 to sdc10 have been plugged after above installation ended.

doing afterwards in console (thanks 2 Jamesbond):

Code: Select all

 udevadm trigger --action=add
results in sda1 to sda6 icons to be displayed;
have manualy reorderd the icons as shown;
Menu/restart X process is much slower ---> be patient ! :roll:
cheers, charlie
Attachments
part-mount.jpg
(26.25 KiB) Downloaded 455 times
part-mount_2.jpg
(29.77 KiB) Downloaded 458 times

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#37 Post by charlie6 »

re-Hi...
1. unplugging and plugging again results in ... a kind of icons "overpopulating" of the desktop...
2. clicking on the X in the icon does not unmount it. Pmount is the only way to unmount?
3. how to erase them when unplugged ...?
restart X does not help....

last edited:
...3.(follow and solved) unplugging the usb flash plugs ---> the corresponding icons switch off ...only the first displayed set remains. OK i understand: this first set displayed, in the above post procedure, upon plugging a flash plug + an usb hdd, before doing « #udevadm trigger --action=add » in console.
So do « #udevadm trigger --action=add » BEFORE plugging.
(for info: i just had to right click on the extra icons and then click «remove item» to erase .

and
4. cd-or-dvd-inserted's icons are not (yet ...?) displayed. I had a dvd inserted along the whole above procedure and not any «sr0» nor «sr1» icon. Yes...the present part-icon-handler manages only USB plugged stuffs, no optical devices.
At this state of art, use of Pmount to manage them.

cheers
Attachments
plug-unplug.jpg
(22.63 KiB) Downloaded 313 times
Last edited by charlie6 on Mon 03 Jun 2013, 03:34, edited 1 time in total.

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#38 Post by seaside »

Iguleder,

Very nice work.

I decided to test this by a normal startup, killing pup_event_frontend_d, and then starting part-hotplug-monitor and plugging in a thumb drive.

Since the icon came up on the left just below "connect", I made some changes in the part-icon script to locate the icon in line with the other drives.

As there was no direct way to unmount the drive, I also made some changes to toggle unmounting by left clicking.

First click, mounts and starts the file manager, second click unmounts the drive....etc..

Other possibilities exist to specify the icon x,y position somewhere else as well.

All the programs are in /usr/bin with no symlinks

Thanks again for this simple direct approach.
Regards,
s

Code: Select all

#!/bin/sh
# part-icon: a utility script for adding and removing ROX-Filer pinboard icons
#            for partitions
# modded to toggle mount and icon placement

# the ROX-Filer command line used for RPC
ROX_RPC_COMMAND_LINE="rox -R"

# _get_partition_icon()
# purpose: determines which icon should be used to represent a partition
# input  : the mount point and device node path of a partition
# output : an icon path
_get_partition_icon() {
	# choose the partition icon, according to the device node name
	case "$2" in
		*floppy*)
			type="floppy"
			;;
		*mmc*)
			type="card"
			;;
		*cdrom*|*sr*)
			type="optical"
			;;
		*sd*)
			type="usbdrv"
			;;
		*)
			type="drive"
			;;
	esac

	# if the partition is mounted, add a suffix to the icon name
	mountpoint -q "$1"
	if [ 0 -eq $? ]
	then
		suffix="_mntd"
	else
		suffix=""
	fi

	echo -n "/usr/local/lib/X11/pixmaps/${type}${suffix}48.png"
}

# _update_partition_icon()
# purpose: changes the icon of a partition to the most suitable one
# input : a partition name
# output: -
_update_partition_icon() {
		echo -n "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
	<env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
	<SetIcon>
		<Path>$HOME/.part-hotplug-handler/$1</Path>
		<Icon>$(_get_partition_icon /mnt/$1 $1)</Icon>
	</SetIcon>
</env:Body>
</env:Envelope>" | $ROX_RPC_COMMAND_LINE
}

case "$1" in
	add)
		# check the command-line usage
		if [ 3 -ne $# ]
		then
			echo "Usage: part-icon remove PARTITION DEVICE_NODE"
			exit 1
		fi

		# create a directory for the partition mounting scripts
		[ ! -d $HOME/.part-hotplug-handler ] && \
		                                       mkdir $HOME/.part-hotplug-handler

		# create the partition mounting script
echo -n "#!/bin/sh
if ! [ -d /mnt/$2 ] #  check whether mount dir exists

then 
   # create a mount point
	mkdir /mnt/$2
	[ 0 -ne \$? ] && exit 1
	# mount the partition
	mount \"$3\" /mnt/$2
	[ 0 -ne \$? ] && exit 1
    xdg-open /mnt/$2
    # mark icon mounted
    part-icon update $2
    
else # check if mounted

  if mountpoint -q /mnt/$2
  then
  
	umount /mnt/$2
	[ 0 -ne \$? ] && exit 1
	# change icon to unmounted
	part-icon update $2
  else
	mount \"$3\" /mnt/$2
	[ 0 -ne \$? ] && exit 1
    xdg-open /mnt/$2
    # mark icon mounted
    part-icon update $2
  fi

fi

" > $HOME/.part-hotplug-handler/$2
		chmod 755 $HOME/.part-hotplug-handler/$2

		# set the icon used
		_update_partition_icon $2
		# align to bottom icons
		line=`grep  'label=\"[[:alpha:]]\{3\}[0-9]' /root/Choices/ROX-Filer/PuppyPin | head -n 1`
		x=${line#*\"} x=${x%%\"*}
		x=$((x+64)) y=704
				
		# add a pinboard icon
		echo -n "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
	<env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
		<PinboardAdd>
			<Path>$HOME/.part-hotplug-handler/$2</Path>
			<Label>$2</Label>
			<X>$x</X> <Y>$y</Y>
		    <Args></Args>
		</PinboardAdd>
	</env:Body>
</env:Envelope>" | $ROX_RPC_COMMAND_LINE
		;;

	remove)
		# check the command-line usage
		if [ 2 -ne $# ]
		then
			echo "Usage: part-icon remove PARTITION"
			exit 1
		fi

		# unmount the partition and delete the mount point
		if [ -d /mnt/$2 ]
		then
			mountpoint -q /mnt/$2
			if [ 0 -eq $? ]
			then
				umount /mnt/$2
				[ 0 -eq $? ] && rmdir /mnt/$2
			fi
		fi

		# remove the pinboard icon
		echo -n "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
	<env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
		<PinboardRemove>
			<Path>$HOME/.part-hotplug-handler/$2</Path>
			<Args></Args>
		</PinboardRemove>
	</env:Body>
</env:Envelope>" | $ROX_RPC_COMMAND_LINE

		# remove the partition mounting script
		rm -f $HOME/.part-hotplug-handler/$2
		;;

	update)
		# check the command-line usage
		if [ 2 -ne $# ]
		then
			echo "Usage: part-icon update PARTITION"
			exit 1
		fi

		# update the partition icon
		_update_partition_icon "$2"
		;;
esac 

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#39 Post by charlie6 »

Hi seaside,
thanks a lot !
i replaced the existing part-icon by yours
and
deleted the symlink /sbin/pup_event_frontend_d to /usr/bin/part-hotplug-monitor;
afterwards creted a script to exec /usr/bin/part-hotplug-monitor and placed it in /root/Startup and rebooted.

I then plugged some thumb drives and got them each twice displayed ... :shock:

i even did « #udevadm trigger --action=add » or « #udevadm trigger --action=change » before plug-in without change.

questions:
and then starting part-hotplug-monitor
which way do you start part-hotplug-monitor?
First click, mounts and starts the file manager, second click unmounts the drive....etc..
whatever right or left click, here it mounts and opens a rox-window at first click, but no unmount at second click; got a second rox-window opened instead.

Maybe had better to start all over from the beginning ..?

cheers

last edited:
icon display versus Pmount status at start: see screenshot below:
«sdc1=mounted» icon whereas Pmount reprots «not mounted»
Attachments
start.jpg
(22.76 KiB) Downloaded 427 times

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#40 Post by charlie6 »

re-re-Hi :D

using forum member seaside's part-icon
+
no symlink to part-hot-plug-monitor (pup_event-frontend_d = «killed»)
+
part-hot-plug-monitor started from /root/Startup:

follow...
i manualy erased (right-click on icon + remove object) the extra icons set;
then rebooted;
the icons are now displayed one each.

(time to shutdown is here long..long..long..be patient)

Cheers

Post Reply