[Request]Automagically mount USB drives + add rox bookmarks

What features/apps/bugfixes needed in a future Puppy
Message
Author
amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#21 Post by amigo »

sunburnt, can you post and attach your original program as it was for oldr versions of Puppy.
I have written a program which does auto-mounting, so I am always inetrested in what others have done/are doing. My solution was based on hotplug, but written with an eye towards implementing the use of udev or some other polling method with mostly the same code.

The older version might be useful as-is for Puppy users who still run older versions for whatever reason.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#22 Post by ecomoney »

eocmoney; for your requests; # 2 - # 4 lets talk about them here where you made them.
Don`t worry about the one you already posted, but lets deal with it here.
Any bugs or comments about usb-auto itself put on the usb-auto post.
That will keep people from wondering what all the other chatter is.

I don`t know what Rox bookmarks are, I have never used them.
usb-auto pops up Rox for the USB drive, so folks shouldn`t have trouble.

Setting downloads and Firefox`s Save Page path, is a good idea.
When I made GUIs, I always set the dialog`s path in the GUI`s code.
Firefox may have config. files that can be tweaked for this, I don`t know.
If you come up with info about this I can help, I won`t dig into Firefox...
Post for help as I always do, the Users forum usually gets the most replies.

To handle your requests I think I`ll make usb-auto run 2 other scripts.
One script for when a USB is plugged in, and the other for unplugged.
When run the USB device (sda1, sb1, etc.) will be passed to the script.
Then anything that you want to happen can be put in these scripts.
You probably will want only the first USB plugged in to be the path.

I`m watching this thread... So keep me informed about it here.

P.S. Found some coding errors ( big surprise ), I`ll post a fix soon.
Hi Sunburnt

Im really itching to test your code! My memory stick is still at work and I wont be able to pick it up til Thursday (having to help a good friend move house in the meantime...as it happens the one that started the abiword ruccus).

The bookmarks are in two places, and Ive found that they are invaluable in helping Linux Newbies navigate the complicated and unfamiliar Linux filesystem. Heres some screenshots of exactly where I mean taken from Ecopup which includes pre-defined bookmarks for the important file locations.

Here is a screenshot of the GTK bookmarks, they are used in application save dialog boxes (Abiword, Seamonkey etc). The actual bookmarks are listed up the left hand side pane. If this script added a bookmark here it would enable them to plug in their pendrive, hit save and be able to save their files directly to their memory stick...the most natural order for them to do this from my observations.

Image

These bookmarks are the ones stored in /root/.gtkbookmarks (explained above)

The other place puppy stores folder bookmarks is in ROX the file manager (many users are confused that a bookmark they create in one isnt created in the other). These are accessed from the button circled in red of the file manager in the Screenshot below.

Image

These bookmarks are stored in xml format in the file /root/.config/rox.sourceforge.net/ROX-Filer/Bookmarks.xml

I hope this clarifies things. When I have more time I will look into the firefox save locations. I think firefox can be set to "Always ask me where to save files", which would bring up the GTK save dialog, with the bookmark your script created. This should solve that problem I think.

Many thanks for your continued work this script.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#23 Post by mikeb »

Ecomoney...when I remaster I include common bookmarks. Flash sticks will generally end up in the same place top including sda1 is a safe bet (or sdb1 for sata) or perhaps the /mnt folder or maybe put symlinks in /root instead as /root is generally treat as a starting point once the clutter is removed such as my-roxapps and such ...

Another point....X is normally launched with /root as the starting folder since we run as user root. If this or the application launcher cd to a different folder then that would be the home..not sure about configs but I do this with the gimp to move its home folder...indeed maybe using user spot might be a good move for public use...presents a nice clean floder and safer too

mike

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#24 Post by ecomoney »

Mike, I agree entirely about puppies confusing directory structure. Much improvement could be made here. Its useful to know that puppy doesnt have to use the /root folder as its applications default. Ive done some testing with ubuntu on some puppy users and one of their very common reports is that its home folder structure is much more comprehensible (folders like music, videos, pictures, documents etc). I suppose it is a case of developers choosing locations to make it easier for them to find programs (that they are interested in) rather than douments (that the intended target audience for Puppy is interested in).
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#25 Post by Sylvander »

One of the 1st things I always do is make /00, /01, /02, /03 folders for holding my sub-folders and files in.

Because of the alpha-numeric organization, these folders are always at the top of the folder hierarchy, and therefore easily seen and found. :D
Attachments
00.jpg
(41.34 KiB) Downloaded 1036 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#26 Post by sunburnt »

I have not been getting email notices about the progress of this thread!

amigo; The code for the daemon`s loop is the same for all the versions.
Actually there`s been 3 main types of code:
1) Attempt to mount everything with "for" loops and just let the errors fly.
2) Try to figure out what devices are attached by polling with "for" loops.
3) Use available reports to try to identify what devices are attached.
The old usb-auto used "dmesg" which Puppy no longer uses.
The new one checks the /sys dir. for /sd* dirs. to identify devices.

ecomoney; Sorry the forum dropped the ball not giving me email notices.
I spent the afternoon writing these 2 scripts, they seem to work well.
usb-auto_mount & usb-auto_umount are run upon USB insert & removal.
Please test them on your computer with usb-auto first!
gunzip them and put them in: /usr/sbin
Plugging in a USB adds lines to the 2 files you gave me.
Unplugging the USB removes the lines from the 2 files.
Both SeaMonkey and ROX showed the added lines and their removal.
Like any new software... There`s probably still bugs in it.
As usb-auto develops these 2 files will keep working.
Let me know how they work...
Attachments
usb-auto_u-mount.tar.gz
Ungzip this file and put the 2 files in: /usr/sbin
(615 Bytes) Downloaded 503 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#27 Post by sunburnt »

### Note: New beta 4 version of USB-Auto at this forum post:

http://www.murga-linux.com/puppy/viewtopic.php?t=45815

ecomoney; have you had a chance to test the 2 event files I gave you?
If they are working we can wrap this up in one more version release!
Cheers... Terry

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#28 Post by sunburnt »

##### Nearly fully tested Beta 5 version. ( Almost done folks! )

http://www.murga-linux.com/puppy/viewtopic.php?t=45815

Included the tested event files to add USB drives to ROX and GTK menus.
Read the changes above the download...

ecomoney; If you could test the Beta 5 version and tell me how it all works?

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#29 Post by ecomoney »

Hi Sunburnt, sorry, it was my Partners Birthday and she wanted taking away from all this!

Testing now
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#30 Post by ecomoney »

Tested and reported on your thread.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#31 Post by sunburnt »

ecomoney; Here`s what I found...

1) While links can have spaces, GTK expects a path, NO SPACES allowed.
....... If there`s even one space in a line the "Save As" menu won`t show it.
2) So I used underlines instead of spaces, that works of course.
....... The menu item looks like this: USB_drive_(_at_sda1_) Kinda messy!
....... I think this looks better: USB_drive_(_sda1_) or: USB_drive_(sda1)
3) The GTK menu cuts off the whole line to the last "/" inclusive.
....... So this: file:///tmp/USB_drive_(_/mnt/sda1_) becomes this: sda1_)
....... This: file:///tmp/USB_drive_(sda1) becomes this: USB_drive_(sda1)
4) /root is a bad place for links, /tmp is better, reboot and they`re gone.

So... Play with what I have given you and decide how you want it to look.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#32 Post by ecomoney »

Hi Sunburnt

I tested the USB auto code on the "Linux Newbies" at the cybercafe today, a very mixed bag of people from all over the world :-) I used version 5 which is the most current version at this time.

As I suspected, the "ginea pigs" had trouble knowing that the "sda1" rox bookmark was the usb drive when downloading. I like the idea of formatting the bookmarks you gave above. I asked the test pilots what comes to mind and held up my pendrive, and they all said "USB", so your idea of naming it "USB_drive_(sda1)" would be perfect I believe for them. Having the default download/upload location from the browser become the pendrive when it is plugged in would definetely help also ("just works") to perfection.

Unfortunately, a couple of things I did (I am Human too!) last time I was there caused about 25 hours of downtime at the cafe, so I would like not to introduce any new code for a week or two apart from testing on individual machines for the next week or two, to give the poor desk volunteers time to regain their confidence in the system :oops:

Cheers for doing the research on the ROX bookmarks, I look forward to the next release with Bookmark naming built in? :)
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#33 Post by sunburnt »

ecomoney; I hope your slip up was not too severe... :-(
I have tested Beta 6 and all seems to work well.
Note: I made links for GTK like: /tmp/usb-auto/USB_drive_(sda1)
Putting them in /tmp is safer than /root, and at reboot everything is gone!
Experience over the years has taught me to put temp. files & etc. in /tmp
I`m trying to decide how to do Firefox paths. I`ll let you know.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#34 Post by sunburnt »

Update: I have it writing the Firefox file: pref.js
It looks for /root but will take any path with /root in it.
My file had: /root/my-documents, and it changes it to: /mnt/sda1
On unmount it replaces: /mnt/sda1 with: /root/my-documents

This is much better, putting things in: /root is just a bad idea, use the Docs. dir..
If you want the client PCs at boot to set the Firefox path, I can do that in usb-auto.
Then if they don`t have a USB plugged in, their Page and Picture Saves,
and Downloads will go to: /root/my-documents
I don`t know if the client PCs have a Docs icon on the Desktop, maybe a good idea.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#35 Post by sunburnt »

Hey ecomoney; Beta 6 is ready for testing... Read the changes carefully...
No rush to test it as I`m taking a little vacation next week.
But I`ll still check in from time to time to see how everything is going...

I think default setting the Firefox Downloads to: /root/my-documents is a good idea...
Success... T.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#36 Post by ecomoney »

Thank you Sunburnt, your holiday is well earnt have a good time. I will test and demonstrate.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#37 Post by sunburnt »

ecomoney; The new version Beta 8 is ready for download... (No Beta 7)
It`s a complete rewrite and I really think it`s a great utility now!
The device test method is different and it handles all removable media!
So I will probably need to rename it to something else.
There`s only one more change I see for it after this.
Puppy 421 and newer has new kernel drivers I want to use in USB-Auto.
But this version is the best yet by far I think... Terry

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#38 Post by ecomoney »

Thanks Sunburnt, I will give it another test at the Mission cybercafe next week. It would be great if all future puppies had this feature, it fits with Puppies mission too. How should we go about requesting it gets added to the official Puppy build?

p.s. Good news about it detecting all attached storage, I guess that means a whole bunch of mobile phones/digital camera's also "just work" now too.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#39 Post by sunburnt »

ecomoney; As I posted on the usb-auto forum, I found a flaw in the code.
It will only handle 1 insert or removable at a time without possible failure.
And the 7 seconds it takes to detect the device is a rather long time.
I have fixed it but I`m still testing it, maybe Sunday. Wait for Beta 9...

As to inclusion into standard Puppy, it use to have HotPup, like HotPlug.
I think Dougal wrote it, but nothing seems to stay in Puppy very long.
Barry`s standard releases don`t seem to retain the added functionality.
So maybe we could ask about it, but it`s irritating to see your work lost.

NOTE: Cameras will work except for Kodak ( never buy a Kodak! ).
Phones I had not thought of... I`m interested to see how they`ll work.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#40 Post by sunburnt »

### Beta 9 is ready for testing...

Q: What should we call the app. now that it does all removable media?

Post Reply