Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 22 Sep 2014, 14:17
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Lighweight pup_event_frontend_d Replacement
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 3 [41 Posts]   Goto page: Previous 1, 2, 3
Author Message
Iguleder


Joined: 11 Aug 2009
Posts: 1907
Location: Israel, somewhere in the beautiful desert

PostPosted: Sat 01 Jun 2013, 11:10    Post subject:  

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 Smile

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? Very Happy
part-hotplug-handler.tar.bz2
Description 
bz2

 Download 
Filename  part-hotplug-handler.tar.bz2 
Filesize  18.16 KB 
Downloaded  151 Time(s) 
screeny.png
Description 
png

 Download 
Filename  screeny.png 
Filesize  47.37 KB 
Downloaded  194 Time(s) 

_________________
My homepage
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
ICQ Number 
simargl

Joined: 11 Feb 2013
Posts: 572

PostPosted: Sat 01 Jun 2013, 17:49    Post subject:  

.
Last edited by simargl on Sun 01 Sep 2013, 11:13; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
charlie6


Joined: 30 Jun 2008
Posts: 1009
Location: South of Belgium

PostPosted: Sat 01 Jun 2013, 23:58    Post subject:  

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
Back to top
View user's profile Send private message 
Iguleder


Joined: 11 Aug 2009
Posts: 1907
Location: Israel, somewhere in the beautiful desert

PostPosted: Sun 02 Jun 2013, 12:45    Post subject:  

Yep, two things:
- It doesn't output anything.
- It still doesn't draw icons for existing partitions, only for newly added ones. Wink

_________________
My homepage
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
ICQ Number 
jamesbond

Joined: 26 Feb 2007
Posts: 2161
Location: The Blue Marble

PostPosted: Sun 02 Jun 2013, 13:25    Post subject:  

@charlie6
To display existing partitions you need to re-trigger udev. See my comment for Karl, in the previous page.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
charlie6


Joined: 30 Jun 2008
Posts: 1009
Location: South of Belgium

PostPosted: Sun 02 Jun 2013, 17:57    Post subject:  

@Iguleder & Jamesbond
Smile
thanks for your help!
it works as expected ...how fast .. Cool ... and believe i will keep it for a while, even if some icons have falled outside the desktops bottom edge ... Shocked
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:
 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 ! Rolling Eyes
cheers, charlie
part-mount.jpg
 Description   
 Filesize   26.25 KB
 Viewed   246 Time(s)

part-mount.jpg

part-mount_2.jpg
 Description   
 Filesize   29.77 KB
 Viewed   236 Time(s)

part-mount_2.jpg

Back to top
View user's profile Send private message 
charlie6


Joined: 30 Jun 2008
Posts: 1009
Location: South of Belgium

PostPosted: Sun 02 Jun 2013, 18:21    Post subject:  

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
plug-unplug.jpg
 Description   
 Filesize   22.63 KB
 Viewed   233 Time(s)

plug-unplug.jpg


Last edited by charlie6 on Sun 02 Jun 2013, 23:34; edited 1 time in total
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Sun 02 Jun 2013, 23:31    Post subject:  

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:
#!/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
Back to top
View user's profile Send private message 
charlie6


Joined: 30 Jun 2008
Posts: 1009
Location: South of Belgium

PostPosted: Mon 03 Jun 2013, 01:15    Post subject:  

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 ... Shocked

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

questions:
Quote:
and then starting part-hotplug-monitor

which way do you start part-hotplug-monitor?

Quote:
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»
start.jpg
 Description   
 Filesize   22.76 KB
 Viewed   215 Time(s)

start.jpg

Back to top
View user's profile Send private message 
charlie6


Joined: 30 Jun 2008
Posts: 1009
Location: South of Belgium

PostPosted: Mon 03 Jun 2013, 03:06    Post subject:  

re-re-Hi Very Happy

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
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Mon 09 Jun 2014, 02:59    Post subject:  

The whole udevadm --trigger is complete garbage !
:
Code:
for anU in `ls -1v /sys/block/*/*/uevent`; do
echo add >$anU; sleep 0.3; done;

and same for "echo remove" ie /sbin/clean_desk_icons

This uses the '-v' switch of `ls' to sort the partition numbers.


What is missing is maybe a second

#define PARTITION_DEVTYPE "partition"

for "disk" :

E: DEVTYPE=disk
E: DEVNAME=/dev/sr0
E: ID_CDROM=1
E: ID_TYPE=cd
E: ID_INSTANCE=0:0
E: ID_BUS=usb


And part-icon could have such code adjusts:
Code:
# check the VARIABES
if [ "$DEVNAME" ]; then
        :
elif [ "$DEVPATH" ]; then
        DEVNAME="/dev/${DEVPATH##*/}"
else echo "$0:Error:Need UDEV's DEVNAME or DEVPATH"; exit 1;
fi
#DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda19
#echo "DEVPATH=$DEVPATH"
#echo "DEVNAME=$DEVNAME"

# create unique path for ROX
test -d $HOME/.pup_event/drive_${DEVNAME##*/} || mkdir -p $HOME/.pup_event/drive_${DEVNAME##*/}
test -f $HOME/.pup_event/drive_${DEVNAME##*/}/mount-and-open -a -x $HOME/.pup_event/drive_${DEVNAME##*/}/mount-and-open || cp -a /sbin/mount-and-open $HOME/.pup_event/drive_${DEVNAME##*/}/

case "$ACTION" in
    add)
        # guess the fs type and don't process further if undesired -
        # set guessfstype as you wish and adjust grep pattern
        guessfstype=guess_fstype
        $guessfstype $DEVNAME | grep -iE "unknown|none|swap|Extended|Ext'd" && exit 0

Code:
        # check for usb
        if test -e /sys/block/${DEVNAME##*/}; then
        realPATH=`realpath /sys/block/${DEVNAME##*/}`
        elif test -e "/sys/block/`echo ${DEVNAME##*/} | sed 's/[0-9]*$//'`/${DEVNAME##*/}"; then
        realPATH=`realpath /sys/block/$(echo ${DEVNAME##*/} | sed 's/[0-9]*$//')/${DEVNAME##*/}`
        fi

        case "$realPATH" in
        *usb*) kDRIVE=usb;;
        *) :;;
        esac

        # check for removable
        if test -f /sys/block/${DEVNAME##*/}/removable; then
        read removABLE< /sys/block/${DEVNAME##*/}/removable
        fi

        case "$removeABLE" in
        1) kDRIVE="${kDRIVE}cd";;
        *) :;;
        esac

        case $ID_BUS in
        usb)  :;;
        scsi) :;; #SATA HDD
        esac

        case $ID_TYPE in
        cd)   :;; # CD
        disk) :;; # HDD USB flash pendrive
        esac

        case $ID_CDROM in
        1):;;
        esac

        case $ID_VENDOR in
        ATA)  :;; # internal (S)ATA
        USB)  :;; #
        esac


My experiences with Xorg s with udev dependencies brought me back here .

Have never encountered USB-FDD and such bizarre devices .
For IDE I could find out .

At the moment at reworking parts of /init - so am occupied with other things for the next times .
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 3 of 3 [41 Posts]   Goto page: Previous 1, 2, 3
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1521s ][ Queries: 13 (0.0259s) ][ GZIP on ]