LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-30-2008, 01:05 PM   #16
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872

Hey it is Woodsman's tutorial, not mine!

Maybe you could try start kaudio creator from a command line in x terminal (Konsole or xterm)
command: kaudiocreator
Maybe it will output significant error messages in x terminal when eject is not available ?
 
Old 08-31-2008, 04:24 AM   #17
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
Quote:
Originally Posted by glore2002 View Post
c) eject -v

Code:
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/sr0'
eject: `/dev/sr0' is not mounted
eject: `/dev/sr0' is not a mount point
eject: `/dev/sr0' is not a multipartition device
eject: trying to eject `/dev/sr0' using CD-ROM eject command
eject: CD-ROM eject command failed
eject: trying to eject `/dev/sr0' using SCSI commands
eject: SCSI eject failed
eject: trying to eject `/dev/sr0' using floppy eject command
eject: floppy eject command failed
eject: trying to eject `/dev/sr0' using tape offline command
eject: tape offline command failed
eject: unable to eject, last error: Inappropriate ioctl for device
Eject has tried to eject the drive using various different commands, one assuming it's a CD-ROM (used as a generic term including CD-RWs), then when that didn't work it tried again with SCSI and then as a floppy drive, then again as a magnetic tape drive.

It then rather unhelpfully tells us that the last error (the error from ejecting as a tape drive) was inappropriate ioctl, ie that your CD-ROM does not understand tape drive commands.

To get eject to tell us the real problem, we need to know what the error message was when using the CD-ROM. The -r flag will tell eject to only use the CD-ROM command, so can you try running
Code:
eject -rv
and posting the output from that?

It might also be interesting to run the same command as root (since you say this works) and compare the output.
 
Old 08-31-2008, 04:41 AM   #18
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Good catch about the -r option for eject
I think the problem is that kaudiocreator does not release access to /dev/sr0 as shown by lsof output
(so I would say it's not a ioctl error but rather an open error)
kiaudio seems also implicated which may indicate that kaudiocreator plays audio cd tracks or does not issue a stop audio playing command or close device command, I don't know
 
Old 08-31-2008, 11:29 AM   #19
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Lubuntu 17.10 x64
Posts: 510

Original Poster
Rep: Reputation: 33
Output from eject -rv

Hi back!

These are the output for eject -rv

Starting from 2nd cd, door doesn't open. So, as normal user, we typed:

$>eject -rv

Door does not open and the output shown is:

Code:
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/sr0'
eject: `/dev/sr0' is not mounted
eject: `/dev/sr0' is not a mount point
eject: `/dev/sr0' is not a multipartition device
eject: trying to eject `/dev/sr0' using CD-ROM eject command
eject: CD-ROM eject command failed
eject: unable to eject, last error: Input/output error
If I do the same as root, door opens and the output is:

#>eject -rv

Code:
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/sr0'
eject: `/dev/sr0' is not mounted
eject: `/dev/sr0' is not a mount point
eject: `/dev/sr0' is not a multipartition device
eject: trying to eject `/dev/sr0' using CD-ROM eject command
eject: CD-ROM eject command succeeded
I hope it helps. Thanks again,
Glore2002.-
 
Old 08-31-2008, 11:44 AM   #20
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Here is the simplest eject CDROM program:
Code:
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/cdrom.h>

int main( int argc, char **argv )
{
        int cdrom;           

        if ((cdrom = open("/dev/sr0",O_RDONLY | O_NONBLOCK)) < 0) {
                perror("open");
                exit(1);
        }
        
        if(ioctl(cdrom, CDROMEJECT) < 0) {
                perror("eject");
                exit(1);
        }
    
        close(cdrom);
        return 0;
}
Save it as myeject.c for example, compile it and execute it:
Code:
gcc -o myeject myeject.c
./myeject
See if it outputs a more meaningful error message
 
Old 08-31-2008, 12:39 PM   #21
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Lubuntu 17.10 x64
Posts: 510

Original Poster
Rep: Reputation: 33
Error I get when trying to compile.

Quote:
Originally Posted by keefaz View Post
Here is the simplest eject CDROM program:
Code:
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/cdrom.h>

int main( int argc, char **argv )
{
        int cdrom;           

        if ((cdrom = open("/dev/sr0",O_RDONLY | O_NONBLOCK)) < 0) {
                perror("open");
                exit(1);
        }
        
        if(ioctl(cdrom, CDROMEJECT) < 0) {
                perror("eject");
                exit(1);
        }
    
        close(cdrom);
        return 0;
}
Save it as myeject.c for example, compile it and execute it:
Code:
gcc -o myeject myeject.c
./myeject
See if it outputs a more meaningful error message

When trying to compile with gcc -o myeject myeject.c, I get the following error message:
Code:
myeject.c: In function 'main':
myeject.c:12: warning: incompatible implicit declaration of built-in function 'exit'
myeject.c:17: warning: incompatible implicit declaration of built-in function 'exit'
Thanks,
Glore2002.-
 
Old 08-31-2008, 12:55 PM   #22
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Ah, I forgot one header file,
Code:
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/cdrom.h>
#include <errno.h>

int main( int argc, char **argv )
{
    int cdrom;
    int error;

    if ((cdrom = open("/dev/sr0",O_RDONLY | O_NONBLOCK)) < 0) {
            perror("open");
            exit(1);
    }
        
    if((error = ioctl(cdrom, CDROMEJECT)) < 0) {
        perror("eject ioctl error");

        switch(error) {
            case ENOSYS:
                printf("cd drive not capable of ejecting\n");
                break;

            case EBUSY:
                printf("other processes are accessing drive, or door is locked\n");
                break;
        }

        exit(1);
    }
    
    close(cdrom);
    return 0;
}

Last edited by keefaz; 08-31-2008 at 03:47 PM.
 
Old 08-31-2008, 03:45 PM   #23
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
I visited http://www.mjmwired.net/kernel/Docum...octl/cdrom.txt
I think it is best to add meaningful errors with ENOSYS and EBUSY return values of CDROMEJECT ioctl(), so edited program above
 
Old 08-31-2008, 04:46 PM   #24
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Lubuntu 17.10 x64
Posts: 510

Original Poster
Rep: Reputation: 33
myeject

Thanks keefaz. I modified code and compile.

I tried kaudio creater in my computer and the same happens:
First cd ripping finishes and you can eject the cd. CD #2 and successive aren't ejected. If I execute myeject, the following error message appears:

Code:
ioctl error: Input/output error
As before, if I become root, I can eject CD.

I really don't know what is going on but this seems to be a problem with ripping software since the same happens in both computers. Do you have Kaudio Creator installed? If so, please, give it a try to see if this happens to you too.

Glore2002.-
 
Old 08-31-2008, 05:05 PM   #25
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Hey what about make your special eject command
add this to your ~/.bashrc:
Code:
alias myeject="killall kio_audio && eject"
I have Kaudio Creator installed, and I tried the program above, on my computer myeject ejects the CD even if Kaudio Creator uses it! I admit I did not reproduce your situation though, as I didn't ripped a whole CD and then used another CD. I will try it as soon as I can

[edit]
Also I modified myeject.c to include 2 more error messages

Last edited by keefaz; 08-31-2008 at 05:08 PM.
 
Old 08-31-2008, 05:11 PM   #26
Franklin
Senior Member
 
Registered: Oct 2002
Distribution: Slackware
Posts: 1,348

Rep: Reputation: 217Reputation: 217Reputation: 217
I've never used Kaudio Creator, but I'll give it a try to see what the deal is. In the meanwhile, I would suggest using Kaffeine. The build script is available at slackbuilds.org. All my ripping and burning is via K3B and Kaffeine.


http://slackbuilds.org/repository/12...edia/kaffeine/
 
Old 09-01-2008, 08:59 AM   #27
Franklin
Senior Member
 
Registered: Oct 2002
Distribution: Slackware
Posts: 1,348

Rep: Reputation: 217Reputation: 217Reputation: 217
Well, no luck reproducing your experiences. I see from your other thread you're giving Kaffeine a try. Good luck.

I have been playing with any ripping/tagging program/script I can find of late, having just acquired an iPod. I have noticed with some KDE applications over the years that they can, on occasion, not give up their hold on a resource. I have also noticed that KDE often trips over itself on ejecting media. You may want to try checking (or unchecking) the box in Kaudio Creator that specifies that the disk be ejected automaticly after it finishes ripping a cd.

There's always the command line.
 
Old 09-01-2008, 11:10 AM   #28
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Lubuntu 17.10 x64
Posts: 510

Original Poster
Rep: Reputation: 33
Thanks Franklin

Thanks Franklin for your suggestion!
yes, I will give kaffeine a try. The only problem I had is related to win32codecs not found by kaffeine. I will try to solve that and see what happens.

Thank you again,
Glore2002.-
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Eject CD/DVD Media using Eject Button - Hal/Udev help v00d00101 Linux - Hardware 4 03-17-2008 03:04 PM
Unmount and Eject with CD-Rom Eject Button? CrownAmbassador Linux - Hardware 3 12-26-2006 08:45 PM
VCD does not eject even eject button pressed ic_torres Linux - Software 4 12-01-2005 05:40 PM
CD Won't Eject With "eject" Command Dr. Ephemeron Slackware 13 11-13-2003 12:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration