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 Sat 20 Dec 2014, 13:30
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
/usr/local/bin/drive_all
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
jlst

Joined: 23 Nov 2012
Posts: 26

PostPosted: Wed 05 Nov 2014, 17:50    Post subject:  /usr/local/bin/drive_all  

First off, excuse my poor english.. my contact with this language
is limited to a few hours a week (internet, animes, video games).

So I was looking at the code in teh Puppy scripts, and I think
I figured out how things work.

------------

Explanation of the mechanism

/usr/local/bin/drive_all

This is a seriously important script and must work perfectly all the time...
It contains the code that is used to mount a drive when a desktop drive icon
is clicked.

This script is automatically copied to:
/root/.pup_event/drive_*/AppRun
for every drive that is shown in the desktop

Exmaple:
/root/.pup_event/drive_sr0/AppRun
/root/.pup_event/drive_sdb1/AppRun
/root/.pup_event/drive_sdb1/AppRun

An entry is added to /root/Choices/ROX-Filer/PuppyPin , example:
<icon x="98" y="596" label="sr0" args="optical udf">/root/.pup_event/drive_sr0</icon>
<icon x="16" y="630" label="sdb1" args="usbdrv vfat">/root/.pup_event/drive_sdb1</icon>
<icon x="30" y="690" label="sda1" args="drive ext3">/root/.pup_event/drive_sda1</icon>

So when debugging the mounting of a CD/DVD drive, we must do:
# sh /root/.pup_event/drive_sr0/AppRun optical udf

And modify the script to fix the issues (we can also get more verbose info)...

If the modifications are correct, then all the code must be copied back to:
/usr/local/bin/drive_all

-----------------------------------

Finding the trouble...

One serious issue is the detection of a DVD Video Disc,
something that is totally unreliable in Puppy Linux

When I was showing my brother how Puppy works. I inserted a data DVD disc
and couldn't mount it, because the media player kept appearing every time,
and it was totally annoying...

That was in 2013, testing Precise Puppy 5.7.1. The board was a pcchips p25g,
the issue didn't happen in my older board (inserting the same disc),
which was a mercury kob .... well, let's continue.

And that was how my brother refused to keep on testing the miracle that is Puppy Linux...

Now that I'm testing tahrpup 6.0 in my older board (I have other 4) with my
modified xorg-conf-auto-pc , for the first time the very same issue happened in this board
and I was shocked...

So I had to modify the code.

---------------

Applying the theory...

So what happens is that cddetect does not work properly for DVDs,
so it must not be used to detect a DVD Video disc... but it is.

I also noticed that sometimes the disc's filesystem is not
properly detected by the script that probes the drives...
(as shown in this finding for example):
<icon x="100" y="624" label="sr0" args="optical none">/root/.pup_event/drive_sr0</icon>
(should be)
<icon x="100" y="624" label="sr0" args="optical udf">/root/.pup_event/drive_sr0</icon>

Even 'dvd+rw-mediainfo' fails to properly detect a DVD *VIDEO* disc.
I mean, not a data DVD that contains AVI,MP4,MKV video files...

So, even in this scenario, /usr/local/bin/drive_all should work properly.
And it partially does with my modifications.

/usr/local/bin/drive_all

Problematic code #1
Code:
  5|8) #video dvd  #140712 5|8)
   ln -snf /dev/${ONEDRVNAME} /dev/dvd
   [ -f /usr/local/bin/defaultdvdplayer ] && exec defaultdvdplayer
   [ "`grep '^exec mplayer' /usr/local/bin/defaultmediaplayer`" != "" ] && exec defaultmediaplayer dvdnav:// #100719 #140712 ^exec
   exec defaultmediaplayer dvd://
   ;;
  0) #failed to detect type.
   #cddetect does not work properly for dvd's, try something else...
   #100719 properly detect dvd video...
   if [ "`df | grep "$dPATTERN"`" = "" ];then #only test if not mounted.
    FLAGDVDVIDEO="`dvd+rw-mediainfo /dev/${ONEDRVNAME} | grep 'Mounted Media: .* DVD-ROM'`"
    if [ "$FLAGDVDVIDEO" = "" ];then
     #mount and look for 'video_ts' directory (dir should contain file video_ts.ifo)...
     mkdir -p /mnt/${ONEDRVNAME}
     mount -t iso9660 /dev/${ONEDRVNAME} /mnt/${ONEDRVNAME}
     if [ $? -eq 0 ];then
      [ -d /mnt/${ONEDRVNAME}/video_ts -o -d /mnt/${ONEDRVNAME}/VIDEO_TS ] && FLAGDVDVIDEO="yes"
      umount /mnt/${ONEDRVNAME}
     fi
    fi
    if [ "$FLAGDVDVIDEO" != "" ];then
     ln -snf /dev/${ONEDRVNAME} /dev/dvd
     [ -f /usr/local/bin/defaultdvdplayer ] && exec defaultdvdplayer
     [ "`grep '^exec mplayer' /usr/local/bin/defaultmediaplayer`" != "" ] && exec defaultmediaplayer dvdnav:// #140712 ^exec
     exec defaultmediaplayer dvd://
    fi
   fi
   ;;


Problematic code #2
Code:
  iso9660|udf) #130128 add udf.
    mount -t $xFSTYPE -o iocharset=utf8 /dev/$xONEDRVNAME /mnt/$xONEDRVNAME
    RETVAL1=$?
    ;; 



-------------------------

Solution #1
Code:
 ## jlst: testing tahr in old hardware, this is unreliable
  #5|8) ## video dvd  #140712 5|8)      
   #ln -snf /dev/${ONEDRVNAME} /dev/dvd
   #[ -f /usr/local/bin/defaultdvdplayer ] && exec defaultdvdplayer
   #[ "`grep '^exec mplayer' /usr/local/bin/defaultmediaplayer`" != "" ] && exec defaultmediaplayer dvdnav:// #100719 #140712 ^exec
   #exec defaultmediaplayer dvd://
   #;;
   
  ## jlst: testing tahr in old hardware: this is also unreliable
  ## the only method that seems to work all the time is mounting and checking for VIDEO_TS folder
  0|5|8) ## failed to detect type.
   ## cddetect does not work properly for dvd's, try something else...
   ## 100719 properly detect dvd video...
   if [ "`df | grep "$dPATTERN"`" = "" ];then #only test if not mounted.
    #FLAGDVDVIDEO="`dvd+rw-mediainfo /dev/${ONEDRVNAME} | grep 'Mounted Media: .* DVD-ROM'`"
    #if [ "$FLAGDVDVIDEO" = "" ];then
      ## mount and look for 'video_ts' directory (dir should contain file video_ts.ifo)...
      mkdir -p /mnt/${ONEDRVNAME}
      mount -t iso9660 /dev/${ONEDRVNAME} /mnt/${ONEDRVNAME}
      if [ $? -eq 0 ];then
         [ -d /mnt/${ONEDRVNAME}/video_ts -o -d /mnt/${ONEDRVNAME}/VIDEO_TS ] && FLAGDVDVIDEO="yes"
         umount /mnt/${ONEDRVNAME}
      fi
    #fi
      if [ "$FLAGDVDVIDEO" != "" ];then
         ln -snf /dev/${ONEDRVNAME} /dev/dvd
         [ -f /usr/local/bin/defaultdvdplayer ] && exec defaultdvdplayer
         [ "`grep '^exec mplayer' /usr/local/bin/defaultmediaplayer`" != "" ] && exec defaultmediaplayer dvdnav:// #140712 ^exec
         exec defaultmediaplayer dvd://
      fi
   fi
   ;;


Solution #2
Code:
 iso9660|udf) ## 130128 add udf.
      ## jlst: always try to mount as udf first, no matter what...
      mount -t udf -o iocharset=utf8 /dev/$xONEDRVNAME /mnt/$xONEDRVNAME
      RETVAL1=$?
      if [ $RETVAL1 -ne 0 ] && [ "$xFSTYPE" != "udf" ] ; then
         mount -t $xFSTYPE -o iocharset=utf8 /dev/$xONEDRVNAME /mnt/$xONEDRVNAME
         RETVAL1=$?
      fi
      ;; 


------

More troubles...

Now that we have vlc1, gnomemplayershell, etc...
there is also the issue that there is no appropiate code in
/usr/local/bin/drive_all to play a DVD Video disc,
it just launches the media player but nothing really happens,
we have to play the disc manually anyway.

So I suggest that instead of calling defaultmediaplayer, defaultdvdplayer,
the script 'playdvd' (to be created) should contain all the code to handle
the playing of a dvd video disc for every possible situation...

In fact, in my mind there is many ideas on how to improve Puppy... only ideas of course
Back to top
View user's profile Send private message 
jlst

Joined: 23 Nov 2012
Posts: 26

PostPosted: Sun 14 Dec 2014, 15:53    Post subject:  

I added some simple dialogs and actions. I also added a few png images

I use yad for simple dialogs. The yad version in precise, tarhpup... is OLD as hell, but I adjusted the code to suit that old version.

I need feedback so I can be certain to make a pull request on github, it works fine here

To start testing, eject the disc and insert again.
drive_all-20141214.pet
Description 
pet

 Download 
Filename  drive_all-20141214.pet 
Filesize  154.32 KB 
Downloaded  12 Time(s) 
Back to top
View user's profile Send private message 
jlst

Joined: 23 Nov 2012
Posts: 26

PostPosted: Sun 14 Dec 2014, 16:01    Post subject:  











]
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
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.0666s ][ Queries: 12 (0.0037s) ][ GZIP on ]