Can we set the 'Default' when using multiple optical drives?

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
User avatar
mikewalsh
Moderator
Posts: 5752
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 640 times
Been thanked: 1782 times

Can we set the 'Default' when using multiple optical drives?

Post by mikewalsh »

Afternoon, guys.

Now, then; Uncle Mike's got a wee query for y'all. I haven't come across this one in the Forums before, although I presume there must be a way of doing it.

This new HP Pavilion desktop does have an optical drive, but it's a laptop-style one; it sits vertically, it's cheap'n'nasty, and has to be closed manually. I'm not very keen on it, TBH.

Shortly before the old Compaq tower "croaked" back in January, I'd treated myself to a brand-new, Philips/Lite-On tray loader; the original was over 14 yrs old at that point, and would no longer open/close without a lot of aggravation. Ever since, the new one has been sitting in a drawer, waiting for me to decide what to do with it. The original was all PATA/IDE connectors, with Molex power plugs; a right "beast" of a thing. The Philips/Lite-On is modern SATA connectors.

I was reading an article over at MakeUseOf.com the other day, and discovered that there are adapter cables available which have a combined SATA data/power connector at one end, and a USB 3.0 plug at t'other end. The Philips tray-loader is solidly-enough constructed, that by the simple expedient of sticking some self-adhesive rubber feet on it I can use it as an external drive. I couldn't install it internally if I wanted to; these new-series Pavilions are all custom-designed by HP, and everything is totally non-standard. Nothing is how you'd expect it to be, so most after-market stuff won't fit.

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

Which brings me to my question. Without physically disconnecting the cheap'n'nasty internal one, is there a way to choose which of the two optical drives is set as the 'default' one? Or does this not apply with optical drives, given that their icon never shows up until you start to run them anyway?

Any thoughts/suggestions/ideas will, as always, be very much appreciated.

TIA.

Mike. ;)

Last edited by mikewalsh on Tue Dec 22, 2020 4:28 pm, edited 1 time in total.

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by taersh »

On my old computer I had two DVD drives. They were connected by IDE cables to the main board IDE slots.
The primary one was always set as /dev/cd (or /dev/cdrom?) and the secondary one was set as /dev/dvd.

I think the "default" is the one where the media is inserted.
Doesn't make sense to have a default optical drive when the media is inserted into the other drive, no?

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

Feek
Posts: 397
Joined: Sun Oct 18, 2020 8:48 am
Location: cze
Has thanked: 49 times
Been thanked: 90 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by Feek »

I only have one DVD drive, but I think the same thing: any optical drive with media not inserted shouldn't be visible neither as a desktop icon nor in Pmount.

User avatar
mikewalsh
Moderator
Posts: 5752
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 640 times
Been thanked: 1782 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by mikewalsh »

That's kinda what I was thinking guys, but I'll tell you why I was asking. I put together that little GUI to work the 'eject' command for the optical drive, and it lets you open/close it without touching it. I'm wondering if it's possible to set it to open one drive, but not the other? Or make it switchable, between the two.....one on /dev/cd(cdrom) and the other as /dev/dvd...

How do you choose which one to use; mount 'em to the named device mount-point, same as you would with a data drive?

Mike. :?

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by taersh »

Usually one can open/close/un-mount/eject the optical drive by the right-click context-menu on the drive icon.
So, why do you have a need for a GUI script?

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
bigpup
Moderator
Posts: 6543
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 796 times
Been thanked: 1361 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by bigpup »

What Puppy version or versions are you using on this HP Pavillion computer?

Without physically disconnecting the cheap'n'nasty internal one, is there a way to choose which of the two optical drives is set as the 'default' one?

Default one to do what?
Boot device order in the bios?

Have you actually gotten the external drive hooked up to the computer using one of these special cables?
It does actually function?

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
galbi
Posts: 50
Joined: Tue Jul 14, 2020 12:53 pm
Location: Buenos Aires - Argentina
Has thanked: 5 times
Been thanked: 10 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by galbi »

just wondering...
Do CD/DVD roms work with UUID, like hard drives?

williams2
Posts: 1037
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 298 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by williams2 »

On my laptop, /dev/sr0 is an optical drive.
/dev/cdrom is a symlink to /dev/sr0
/dev/dvd is a symlink to /dev/sr0

For example, these commands all do the same thing:

Code: Select all

eject
eject /dev/sr0
eject /dev/cdrom
eject /dev/dvd

Your second optical drive might be /dev/sr1

You can set up the symlinks to suit yourself.

Doing this will read the data from your optical device, and in this case, throw the data away:

Code: Select all

cat /dev/sr0 > /dev/null

It might be useful to type: eject --help

williams2
Posts: 1037
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 298 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by williams2 »

Do CD/DVD roms work with UUID, like hard drives?

The UUID would be the UUID of the file system on the particular optical disc, if that would be useful.
Each disc would have it's own unique UUID.

Code: Select all

lsblk -f
blkid
User avatar
mikewalsh
Moderator
Posts: 5752
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 640 times
Been thanked: 1782 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by mikewalsh »

@bigpup :-

bigpup wrote: Tue Dec 22, 2020 7:42 pm

What Puppy version or versions are you using on this HP Pavillion computer?

Without physically disconnecting the cheap'n'nasty internal one, is there a way to choose which of the two optical drives is set as the 'default' one?

Default one to do what?
Boot device order in the bios?

Have you actually gotten the external drive hooked up to the computer using one of these special cables?
It does actually function?

Mm....kind of! This thing works fine with my old 500GB WD 'Blue' HDD, for instance. Reads/writes, everything works fine & dandy. The internal DVD/RW - which I want to use as an 'external' item - it doesn't even 'see' it.

(And, er, no; I'm starting to realise that with optical drives, there's no such thing as 'default'. The machine doesn't 'see' ANY optical drive until you put a disc into it. Only then does the kernel 'wake up', figure out what you've just asked it to do, and make the appropriate 'connections'. [Or whatever it IS that it does with optical drives...])

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

Seems there's more to these things than meets the eye. When isn't there..?? :roll: There's a few chipsets in circulation for these largely 'generic' items; some recognise SATA optical drives, some don't. I have to say that in my opinion, both Amazon AND eBay's documentation is woefully lacking in respect of these items. Not one of them specifies the chipset OR capabilities. It seems to be a case of 'pot luck' as to whether or not you get one that does what you need. ('Slapped wrist', you two. Not impressed this time around..!)

That aside, it appears I need to shell out a few quid more for one of the versions that support SATA optical drives - a VL711 chipset is the one I need, it seems. None of these things are expensive, anyway, but it will be another week or two before I get another one ordered. It's not a priority item.....just something I want to make use of, rather than sitting in a cupboard collecting dust.

I normally make a rather better job of researching stuff before I buy it, but I've been somewhat 'stymied' this time round due to a lack of info from the vendors..!

(@ all:- I shall re-visit this thread before too long, once I've got something positive to report.... Watch this space.)

Mike. :)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
mikewalsh
Moderator
Posts: 5752
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 640 times
Been thanked: 1782 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by mikewalsh »

Right. Now then.....

Following an article I found at MakeUseOf.com about these devices, I got a link to the item I need at Amazon US.....and then cross-linked it back to Amazon UK.

https://www.amazon.co.uk/Upgraded-Versi ... 154&sr=8-7

This one uses the above-mentioned VL711 chipset, and in many ways is exactly like the "bridge" circuit board that was at the back of my external Seagate 'Expansion' desktop drive, before I stripped it down and put the Barracuda from inside it into the Pavilion as a secondary data drive.

It plugs into the SATA data/power connectors with a combined connector. On the back of it, there's one of those odd '2-in-1' USB 3.0 connectors you get on external HDDs/SSDs.....looks like an elongated "B", and has separate data + power-supply channels. I believe it's officially referred-to as a "micro-B":-

Image

At one end, there's a fat, centre-pin jack socket/plug for a 12v, 2A power supply. I guess this is more for for the extra power required by 3.5 in desktop HDDs, these having a somewhat beefier drive motor to cope with the extra weight of the larger platters. It's also needed by an optical 'tray-loader' for the motorised 'drawer' mechanism; apparently the 'micro-B' doesn't supply sufficient power for this as well, so the adapter is required.

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

I'm pleased to report it works A-OK, OOTB. The one peculiarity, this being a 'secondary' optical drive, is that it needs mounting separately with pMount before Puppy will 'see' it as /dev/sr1. The default optical drive, of course, is seen as /dev/sr0, and being permanently connected internally, auto-mounts as soon as a disc is inserted. As williams2 reported above, going into /dev does indeed show that /dev/cd & /dev/dvd are both sym-links to /dev/sr0...

@taersh :-- To answer your question about "why do I need a GUI script", you're quite right; I don't, not really. But I threw one together one day, year before last just for the hell of it, because I was at a loose end. This was prompted by the discovery that radky has provided the 'Eject' command at the foot of the Multimedia menu in DPup Stretch, just for optical drives. I looked up the man page for the 'eject' command, adapted an existing YAD script template I've used for a few things, and there it was; the "lazy man's way to eject AND close your optical drive"!

(*shrug*)

Just one of those 'silly' things we all occasionally succumb to....simply because we can.

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

And this all brings me back to my original question, since I now have 2 functional optical drives.....though I'd like to apply this to the 'TrayControl' GUI script, and make it 'switchable' to work with whichever drive I'm using at the time. The scripts that do the work are super-simple. This is 'EjectTray.sh':-

Code: Select all

#!/bin/sh
#
# Eject CD/DVD tray
#
eject
#
/usr/lib/gtkdialog/box_splash -placement top -bg red -fg black -timeout 6 -text " WARNING : Tray open....... "

.....and this is 'CloseTray.sh':-

Code: Select all

#!/bin/sh
#
# Close the CD/DVD tray
#
eject -t
#
/usr/lib/gtkdialog/box_splash -placement top -bg "#07FE18" -fg black -timeout 6 -text "### TRAY CLOSED ###  
     Ready for use....."

The only difference being in the '-t' switch and the different text in the splash-box. Anybody have any suggestions for a simple method for choosing which of the 2 drives to apply the commands to..?

TIA.

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
mikewalsh
Moderator
Posts: 5752
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 640 times
Been thanked: 1782 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by mikewalsh »

Sorted..!

Simple as pie when ya think about it.

The 'default' (built-in) optical drive is recognised by the kernel, and listed in /dev, as /dev/sr0. When plugged-in, and connected, the secondary - "external", formerly internal - drive appears as /dev/sr1.

I had one of those 'lightbulb' moments, y'know? Similar to mounting ANY drive from the terminal.....or writing to a drive with "dd". You give the command first, followed by the drive you want it applied to. So.....

In the terminal:-

Code: Select all

eject

.....by itself, opens the built-in optical drive, /dev/sr0.

Code: Select all

eject -t

.....without specifying a drive, would normally close the drive, but this being a cheap'n'nasty laptop-style one, ya gotta push it shut, manually.

With the 'external' drive plugged-in, and powered-on:-

Code: Select all

eject /dev/sr1

.....opens the drive tray of the 'external', and doesn't do anything to the internal cheapie. And

Code: Select all

eject -t /dev/sr1

.....causes the external's tray to close again. Bingo! Bob's yr Uncle....

So, the original 'TrayControl':-

Image

.....has now become:-

Image

I've done away with the 'Close' button for the internal drive. On this one, it doesn't DO anything..... :lol: :lol: But it's exactly what I was after.

We are Puppy!! (Yay..!)

Mike. ;)

Last edited by mikewalsh on Thu Dec 24, 2020 10:21 pm, edited 1 time in total.

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

williams2
Posts: 1037
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 298 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by williams2 »

I'm not sure exactly what you want.

You can test for the existence of /dev/sr1, like this:

Code: Select all

test -a /dev/sr1 && echo 'sr1 exists'
# or like this
if test -a /dev/sr1
then
  echo 'sr1 exists'
else
  echo 'sr1 does not exist'
fi

test -e should also work. Type "help test"

Does eject work even if /dev/sr1 does not exist?

Code: Select all

eject /dev/sr1

If not, you might be able to test for the existence of the drive using "usb-devices"

Maybe hdparm would work? I think /dev/sr1 would need to exist for hdparm to work.

Code: Select all

hdparm -I /dev/sr1

You can force the default symlinks like this:

Code: Select all

ln -sf /dev/sr1 /dev/cdrom
ln -sf /dev/sr1 /dev/cd
ln -sf /dev/sr1 /dev/dvd

whether or not /dev/sr1 exists. That might be all you need.
(I don't have a /dev/cd symlink)

It's probably a udev rule that is creating /dev/sr1

Edit: I wrote this before reading your last post.

User avatar
mikewalsh
Moderator
Posts: 5752
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 640 times
Been thanked: 1782 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by mikewalsh »

@williams2 :-

Nah, you're OK, mate. No worries.

Like I said, I didn't in fact even bother with testing for the existence of a mount-point, or anything like that. I knew that the 'device name' (in /dev) for an in-built optical drive is always 'sr0' for us here in Puppy. After plugging the old 'internal' tray-loader in (it's almost brand-new, but it was in the old tower, so I think of it as the 'old' one), I had a look in /dev, just out of curiosity, and sure enough, there was 'sr1', as well.

I knew that if you do anything in the terminal in respect to drives in general, it's always 'command' - space - 'device'. I wanted to apply a command - in this case, 'eject' - to a 'device' (in this case, /dev/sr1), so I made a bit of a 'leap of faith', and just tried it. And it worked.

As I said to taersh, no, strictly speaking, I don't HAVE to use any kind of a GUI to eject either drive. But the tower itself is situated several feet away from where I sit, and the truth of the matter is that with me being a lazy so-and-so ( :lol: ), I wanted to operate it from the screen GUI I built a couple of years ago, rather than having to get up and open/close it, followed by walking back to my chair..!

I mean, after ALL, 'puters ARE supposed to be all about 'automation', aren't they...? :shock: :P :D

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
bigpup
Moderator
Posts: 6543
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 796 times
Been thanked: 1361 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by bigpup »

If you have the external one plugged into computer, when you boot.
Wouldn't that make it be seen as a device.
So, when you put in a disk.
It would pop up on the desktop with a drive icon.

If you have desktop hotplug support selected in Puppy Event Manager.
Seems like it would give you a desktop drive icon when you put a disk in.
Even, maybe activate whatever program would use the disk.

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
mikewalsh
Moderator
Posts: 5752
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 640 times
Been thanked: 1782 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by mikewalsh »

bigpup wrote: Thu Dec 24, 2020 11:23 pm

If you have the external one plugged into computer, when you boot.
Wouldn't that make it be seen as a device.
So, when you put in a disk.
It would pop up on the desktop with a drive icon.

If you have desktop hotplug support selected in Puppy Event Manager.
Seems like it would give you a desktop drive icon when you put a disk in.
Even, maybe activate whatever program would use the disk.

@bigpup :-

Heh. You might think that would be the case, but in essence, the very fact of its being what it is prevents that from occurring.

Think about it. Linux OSs primarily deal with files, yes? ('Everything in Linux is a file....') Any drive that shows up on the desktop, I can pretty much guarantee it'll have at least one, formatted, readable partition on with a functional file-system.

You try plugging-in a brand-new, unformatted HDD/SSD. (Not very common, but you can get them.) pMount, or any of the usual tools won't 'see' it. At all... I know this from the odd occasions when I've 'zero-ed' a USB drive with the 'dd', '/dev/null' stuff.....and then forgotten to re-format it afterwards. You can plug, re-plug, re-boot as many times as you like; until there's something on there the system can 'work with', it doesn't even 'see' it.

It's the same with an optical drive. It works with removable disks, and it's those removable disks that contain the file system. The optical drive is nothing more than a drive motor/platter, a laser 'read/write' lens, a power supply, the software that controls it, and a case to contain it all. The drive doesn't contain a thing the system can understand.....until such time as you insert a CD/DVD into it. Then, things start to happen.....

I guess stuff might happen if you accidentally left a disc in there, yes, but that's something I think I've done maybe twice in my life..... I don't make a habit of it! :D

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
bigpup
Moderator
Posts: 6543
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 796 times
Been thanked: 1361 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by bigpup »

If you have the external drive plugged in when you boot.
Pup-Sysinfo->Devices->Drive Storage->CD/DVD
Doesn't it show both drives?
sr0
sr1

With one being connected by USB.
Maybe it shows up under USB

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
mikewalsh
Moderator
Posts: 5752
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 640 times
Been thanked: 1782 times

Re: Can we set the 'Default' when using multiple optical drives?

Post by mikewalsh »

bigpup wrote: Fri Dec 25, 2020 12:24 am

If you have the external drive plugged in when you boot.
Pup-Sysinfo->Devices->Drive Storage->CD/DVD
Doesn't it show both drives?
sr0
sr1

With one being connected by USB.
Maybe it shows up under USB

Oh yah....sure. The system recognises that there's hardware plugged in, of course it does; that's what hardware detection, hot-plugging & the kernel itself is all about, at the end of the day. But Puppy won't in fact DO anything with an optical drive UNTIL there's a file-system present for it to work with, because the optical drive, by itself, is about as much use as a chocolate teapot. Until you load a disk into it, what CAN it do? Image

(It's the same issue with a tape recorder/player. It's designed to work with cassette tapes; until you load one into it, there's not a lot it can do by itself....)

You're right about the 'USB' aspect though, because the system is actually seeing this as a USB adapter, given that it's running via the USB 3.0 sub-system. I tried booting from LiveCD earlier on - I have a Tahr64 multi-session DVD, the only one I've ever created in fact - and curiously, I was getting the 'SFS not found' thing, which was formerly only seen in USB frugal installs before the 'fix-usb.sh' script entered general use. That pretty much eliminated it, of course.....but then, this IS being seen as a USB device (and the device it's attached to, the optical drive, reads considerably more slowly still).

Maybe, for this particular scenario, the script's delay needs to be increased when the disk is created? Just a thought, though it's not a priority right now. Could be interesting to find out what DOES happen, though.....just for the hell of it.

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

Post Reply

Return to “Users”