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 Sun 23 Nov 2014, 07:26
All times are UTC - 4
 Forum index » Advanced Topics » Hardware
iMac Superdrive on Puppy. [Solved] sort of...
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [17 Posts]   Goto page: 1, 2 Next
Author Message
killapup


Joined: 25 Apr 2012
Posts: 73
Location: Warwick, Qld, Australia

PostPosted: Wed 13 Jun 2012, 21:17    Post subject:  iMac Superdrive on Puppy. [Solved] sort of...
Subject description: Has anyone tried or had success with this?
 

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, 05:57; edited 2 times in total
Back to top
View user's profile Send private message 
killapup


Joined: 25 Apr 2012
Posts: 73
Location: Warwick, Qld, Australia

PostPosted: Sun 17 Jun 2012, 20:08    Post subject:  

So... my guess is that no-one has tried this or had any success whatsoever, am I correct???
Back to top
View user's profile Send private message 
Makoto


Joined: 03 Sep 2009
Posts: 1808
Location: Out wandering... maybe.

PostPosted: Sun 17 Jun 2012, 22:09    Post subject:  

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. Very Happy
(...and, IIRC, Superdrives are also riplocked, so I don't know if that affects performance...)

_________________
[ Puppy 4.3.1 JP, Frugal install | 1GB RAM | 1.3GB swap ] * My Pidgin Builds for Puppy 4.3.1+
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).
Back to top
View user's profile Send private message 
TLM


Joined: 09 Mar 2010
Posts: 173
Location: Central United States

PostPosted: Mon 18 Jun 2012, 02:02    Post subject:  

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:
[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:
[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:
    <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.
Back to top
View user's profile Send private message 
killapup


Joined: 25 Apr 2012
Posts: 73
Location: Warwick, Qld, Australia

PostPosted: Mon 18 Jun 2012, 07:27    Post subject:  

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


Joined: 25 Apr 2012
Posts: 73
Location: Warwick, Qld, Australia

PostPosted: Tue 19 Jun 2012, 08:18    Post subject:  

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


Joined: 12 Sep 2008
Posts: 667
Location: Down-Under in South Oz

PostPosted: Tue 19 Jun 2012, 09:57    Post subject:  

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

_________________
This aging business really bugs me - it didn't bother me years ago, so why is it happening now??
meownplanet - puppylinuxstuff
Back to top
View user's profile Send private message 
killapup


Joined: 25 Apr 2012
Posts: 73
Location: Warwick, Qld, Australia

PostPosted: Tue 19 Jun 2012, 18:46    Post subject:  

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


Joined: 11 Oct 2008
Posts: 7841
Location: qld

PostPosted: Tue 19 Jun 2012, 19:24    Post subject:  

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:

<Key keycode="236">exec:defaultbrowser</Key>


You can find keycodes with a command line program "xev"
Code:
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!
eject.1.html.gz
Description  run "gunzip eject.1.html.gz" from terminal or just click it!
gz

 Download 
Filename  eject.1.html.gz 
Filesize  3.85 KB 
Downloaded  208 Time(s) 

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
CatDude


Joined: 03 Jan 2007
Posts: 1497
Location: UK

PostPosted: Wed 20 Jun 2012, 05:56    Post subject:  

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:
xev | grep -A11 --line-buffered '^KeyPress'


Or this, if you want even less output:
Code:
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
.

_________________

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


Joined: 25 Apr 2012
Posts: 73
Location: Warwick, Qld, Australia

PostPosted: Wed 20 Jun 2012, 18:44    Post subject: iMac Superdrive on Puppy. (solved)
Subject description: Success at last.
 

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

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


Joined: 11 Oct 2008
Posts: 7841
Location: qld

PostPosted: Wed 20 Jun 2012, 19:06    Post subject:  

Excellent Smile

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 )

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
killapup


Joined: 25 Apr 2012
Posts: 73
Location: Warwick, Qld, Australia

PostPosted: Thu 21 Jun 2012, 07:52    Post subject:  

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

Thanks

Ray
Back to top
View user's profile Send private message 
Makoto


Joined: 03 Sep 2009
Posts: 1808
Location: Out wandering... maybe.

PostPosted: Thu 21 Jun 2012, 13:43    Post subject:  

Edit your original (first) post in this thread. That'll allow you to change the thread title.
_________________
[ Puppy 4.3.1 JP, Frugal install | 1GB RAM | 1.3GB swap ] * My Pidgin Builds for Puppy 4.3.1+
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).
Back to top
View user's profile Send private message 
killapup


Joined: 25 Apr 2012
Posts: 73
Location: Warwick, Qld, Australia

PostPosted: Thu 21 Jun 2012, 18:30    Post subject:  

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
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [17 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Hardware
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.1044s ][ Queries: 12 (0.0051s) ][ GZIP on ]