iMac Superdrive on Puppy. [Solved] sort of...

What works, and doesn't, for you. Be specific, and please include Puppy version.
Post Reply
Message
Author
User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

iMac Superdrive on Puppy. [Solved] sort of...

#1 Post by killapup »

G'day all,

I couldn't find anything on the forum regarding this issue but if I've overlooked it somehow, can someone please point me at the thread? Thanks.

I have a defunct G5 iMac that has a still useable optical drive, specifically a Superdrive. I have pulled it out of the machine and attached it to my thin client running Slacko 5.3.3 via USB using a $6 JAE50 to USB adapter. And, voila! it works... sort of.

The problem I am having is that it won't always recognise the disks I put into it (MP3 and DVDs, for example). With that, it won't always eject them either and not having a button to press (its a slot-load) I can only eject via software (or pull the lid of the unit). I have found that I can use eject cdrom through the console once but if I want to use that command again, it will only work after a restart.

I am a long-time Apple user and I know they do things a little differently to other companies but I wonder if someone out there in Puppy world has tried this particular adaptation before and what was their experience?

What I am looking for, I guess, is some way to control the hardware directly. I use an Apple extended keyboard which has the eject key but of course that doesn't work under Linux. I would like to map that key to the eject function, naturally.

Having to restart to make the command line eject work is just not an option so a script or something to refresh whatever needs to be refreshed to make it work would be useful, I'm not a script writer/programmer, so would be looking for suggestions as to how to proceed and where to look. If anyone can help, I would appreciate it very much and 'thanks' in anticipation. Of course, if you need more specific hardware/technical information, I will happily supply it if I can.

Cheers all.
Last edited by killapup on Sun 24 Jun 2012, 09:57, edited 2 times in total.

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

#2 Post by killapup »

So... my guess is that no-one has tried this or had any success whatsoever, am I correct???

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#3 Post by Makoto »

Yeah, nobody's probably tried it.

Hmm. Now, I'm wondering if Superdrives respond to the same signals as a regular CD/DVD drive, or if they require special signals/keypresses.

I'd have to tear apart my Mini to try it myself, though. :D
(...and, IIRC, Superdrives are also riplocked, so I don't know if that affects performance...)
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

User avatar
TLM
Posts: 183
Joined: Tue 09 Mar 2010, 05:14
Location: Central United States

#4 Post by TLM »

I use a couple of .desktop files that i created to eject and close a normal cd drive. Dont know if they will work with your setup, but here they are:

Code: Select all

[Desktop Entry]
Type=Application
Name=EjectCD
Exec=eject

Icon=arrowdown
Categories=AudioVideo;
#Terminal=true
#GenericName=
#Comment=
#NoDisplay=
#Hidden=
#OnlyShowIn=
#NotShowIn=
#TryExec=
#Path=
#StartupNotify=true
#StartupWMClass=

Code: Select all

[Desktop Entry]
Type=Application
Name=CloseCD
Exec=eject -t

Icon=arrowup
Categories=AudioVideo;
#Terminal=true
#GenericName=
#Comment=
#NoDisplay=
#Hidden=
#OnlyShowIn=
#NotShowIn=
#TryExec=
#Path=
#StartupNotify=true
#StartupWMClass=
Copy them with a text editor (Geany, Leafpad, etc) and put them into your /usr/share/applications directory. You will need to supply your own icons. I am using Openbox and i map key combinations to these commands in the rc.xml file as follows:

Code: Select all

    <keybind key="W-c">
      <action name="Execute">
        <command>eject -t</command>
      </action>
    </keybind>
    <keybind key="W-e">
      <action name="Execute">
        <command>eject</command>
      </action>
    </keybind>
However you will have to use another means of mapping them to your keyboard if you are not using Openbox. I think there is a PupApps function that lets you do that, but i am not sure. I removed a lot of stuff from my custom remasters of Lucid and Slacko, and i do not have PupApps installed.

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

#5 Post by killapup »

Hey thanks, Makoto and TLM,

I'll see how I go but at least it gives me somewhere to start. I'll keep you posted, cheers,

Ray

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

#6 Post by killapup »

Hey TLM,

I've tried your script/.desktop file and initial result is no go, I get a 'Can't find Exec command in file' error.

Any suggestions?? Would be appreciated, thanks.

I find now that I can't use the 'eject cdrom' command from the console any more, it can't open /dev/sr0?? But I did find another way to eject a disk that won't mount, get this...

I started the Remaster Puppy liveCD app which mounted the disk that was in the drive, from there I was able to use the console to use 'eject cdrom' as before, go figure. Maybe there is something in that routine that I can use to control things, who knows??

Anyway, thanks for your help so far.

Ray

User avatar
russoodle
Posts: 707
Joined: Fri 12 Sep 2008, 17:36
Location: Down-Under in South Oz

#7 Post by russoodle »

hi killapup....i also have a mac, currently running Slacko 5327, and found that just typing eject in the console, not eject cdrom, works a treat, but then mine is still intact (ie. within the machine), so i don't know if that might have something to do with your issue.

Also, when you say that you tried TLM's .desktop script, which did you mean? because he posted two..
[i][color=Green][size=92]The mud-elephant, wading thru the sea, leaves no tracks..[/size][/color][/i]

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

#8 Post by killapup »

Thanks for your comment, russoodle, I've just done a bit more experimenting with it and found that basically it doesn't do the same thing twice... most times.

I have found that mostly it would eject ok after a restart, but this morning I found that if I just unplug the unit from the USB port and replug it, even the eject command would work and it actually worked twice in a row. I first tried the eject command by itself but it didn't work so with a bit of googling I found the eject cdrom and it worked. When the commands don't work, I get an 'eject: unable to open '/dev/sr0'' error.

I'm not sure if you are aware but this is only a problem when the system won't mount a cd/dvd, If the disc mounts, everything is fine. As for the script from TLM that I used, it was the first one he posted as the second one doesn't apply, no tray to close.

I wonder, too, if I'm not going about this the wrong way, maybe I need to find out why it is not mounting certain discs?? Anyone have any ideas on that? Thanks anyway for your help,

Ray

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#9 Post by 01micko »

Ah.. I see what's happening killapup!

When the drive get's the "eject" signal it's actually ejecting the whole drive as well as the cd. Maybe doing a "man eject" in console or some googling will turn something up on this...

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

Later: Ok, there are lots of options to "eject" you can try.
I'll attach the manual so you can see for yourself, it's from FatDog but it's the same in all Linux.

TLM's keybinding is for openbox. If you are using default jwm in slacko or wary then you'll need something different. The "eject -t" option is probably useless with your superdrive as it is on a laptop cd drive.

Here is an example of a JWM key binding

Code: Select all

<Key keycode="236">exec:defaultbrowser</Key>
You can find keycodes with a command line program "xev"

Code: Select all

KeyPress event, serial 31, synthetic NO, window 0x2600001,
    root 0x15a, subw 0x0, time 10527517, (703,299), root:(758,369),
    state 0x10, keycode 127 (keysym 0xff13, Pause), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 31, synthetic NO, window 0x2600001,
    root 0x15a, subw 0x0, time 10527653, (703,299), root:(758,369),
    state 0x10, keycode 127 (keysym 0xff13, Pause), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
That's what I get when I press the Pause/Break key on a standard US 104 keyboard. Note the "keycode 127".

So, if you want to map your eject key choose it while running xev and note the keycode and use it in the JWM keybinding. While using xev pay close attention! It records every input event, even the slightest mouse movement, so soon fills up your terminal window and it can be cumbersome to scroll back through as it is recording your scroll events as you use the input system.

You'll notice the "defaultbrowser" entry in the above key code. That is where you call your desired program. Replace that with the name to your script once you figure out how to eject. Make sure your script is in the executable PATH. $HOME/my-applications/bin is a good place to start (Note HOME = root when running as user "root").

Now that you have a key binding line you need to place it somewhere. The usual place is $HOME/.jwm/jwmrc-personal. Note that .jwm is a hidden directory. Put it down the bottom just above </JWM>. Restart jwm.(from the Shutdown menu).

Have fun!
Attachments
eject.1.html.gz
run &quot;gunzip eject.1.html.gz&quot; from terminal or just click it!
(3.85 KiB) Downloaded 273 times
Puppy Linux Blog - contact me for access

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#10 Post by CatDude »

Hi
01micko wrote:......While using xev pay close attention! It records every input event, even the slightest mouse movement, so soon fills up your terminal window and it can be cumbersome to scroll back through as it is recording your scroll events as you use the input system.
You could try this:

Code: Select all

xev | grep -A11 --line-buffered '^KeyPress'
Or this, if you want even less output:

Code: Select all

xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
If using that last command,
you may sometimes need to wiggle the cursor (after pressing a key) to see the output.

CatDude
.
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

iMac Superdrive on Puppy. (solved)

#11 Post by killapup »

G'day all you good people who have contributed to my query, I have success at last. :D

Thanks micko and CatDude, for your more recent responses, and particularly for the key binding code suggestions, that was what helped. Along with the man page for eject, I found that the command I needed to use was eject cdrom -r. The testing I have done to now has proved 100% successful. One good part was that I didn't need to write a separate script, I just included the command in the key binding and it worked.

I now have an eject key that will eject a cd from my drive whether it is recognised or not. So, thanks again and keep up the good work, bless you all,

Ray

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#12 Post by 01micko »

Excellent :)

Now just mark as [Solved] in the main post subject line and we can all live happily ever after! (Flash will no doubt remind you of this :wink: )
Puppy Linux Blog - contact me for access

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

#13 Post by killapup »

Ok, I'll bite, how do I mark it as [Solved]? I can't find anything to indicate how to do that, and I've never had an issue solved on a forum before. :?

Thanks

Ray

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#14 Post by Makoto »

Edit your original (first) post in this thread. That'll allow you to change the thread title.
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

#15 Post by killapup »

Thanks Makoto,

and thanks to all who contributed to the solution, I guess I will have lots more queries in the future but at least I will have confidence that I have people I can call on to help,

Catch you later,

Ray

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

Part II

#16 Post by killapup »

G'day again,

after thinking that I had got it all sorted with previous posts and responses and after some further testing, it seems that it is not that simple.

While the eject key on the Apple keyboard (keymapped as per micko's directions) does eject the disk, it still doesn't work all the time, :cry:

Sometimes, when the disk gets past a certain point and is still not mounted, it will not eject. I think if I leave it in the drive long enough, it gets to a point where it will again be ejectable, but I'm not patient enough to test that properly.

I can, as I said earlier, pull the USB plug out and put it back in again and it will be able to be ejected. I just have to listen for the little noises it makes and eject at the right time for it to work. But, of course, if I leave it too long it goes into some unejectable zone again and I have to repeat the unplugging sequence.

Again, as I have said earlier, if the disk mounts and the icon appears on the desktop, all is good and it can be ejected. But, of course, not all disks will mount, will they?

I have found that of 3 disks I have tried, 2 will mount but the other won't. One that will mount each time is the cover disk on the Linux Format magazine #155, no worries, my Puppy Slacko 5.3.3 liveCD will mount but my Puppy Slacko 5.3.1 disk just will not mount. They are all ISO 9660 (Rockridge) format and should (to my way of thinking) mount equally, but they don't???

I put a DVD in the drive the other day and it mounted, got to a menu screen, I clicked play and it started to play, got to about 19secs of the scene and just stopped, would not resume playing even though the disk was still spinning, I think. I might try that again and see what happens but I'm sure it was still spinning.

Is this one of those situations where I should just cut my losses and buy a drive that will work or is there value in pursuing this further? I have read stuff about flashing the firmware, is that a possible fix? Or am I just bashing my head again a brick wall???

If anyone has any further thoughts on this, I'd be pleased to hear them, cheers all,

Ray

User avatar
killapup
Posts: 76
Joined: Wed 25 Apr 2012, 11:48
Location: Warwick, Qld, Australia

#17 Post by killapup »

Ok, so I've gone back and tested the DVD mentioned earlier and, guess what? it played through. I left it go for 20 minutes. Ok, the playback wasn't terribly good but it didn't freeze, and the sound and vision were sometimes in sync, but it played, go figure????

So, to reiterate, it doesn't seem to do the same thing twice!?!?!?!?

I was also reading the other day about someone who had to recompile their Linux kernels to allow cd access. Now I know that this is not the issue here as my brother's Medion (Aldi brand) drive worked without a hitch, I had to give it back. :cry: It just adds to my frustrations as I know Puppy can do it, I think it is just the Apple drive??? :(

But that leaves me with the question, where to from here??

Cheers again,

Ray

Post Reply