Disabling eject button?

T4x series specific matters only
Post Reply
Message
Author
dalee18
Freshman Member
Posts: 51
Joined: Wed Jul 07, 2004 9:40 am

Disabling eject button?

#1 Post by dalee18 » Sun Aug 15, 2004 3:31 pm

Does anyone know if there is a way to disable the eject button on a t42 cd drive? I mean the physical button, so that pressing it wouldn't cause the drive to open, but I could still go into windows explorer and right click on the drive and choose eject. The eject button is in the exact spot where I tend to grab my laptop to move it, and so at least a couple times a day I accidentally open the drive, which is just a bit annoying. Thanks in advance.

ian
**SENIOR** Member
**SENIOR** Member
Posts: 765
Joined: Sun Apr 25, 2004 1:18 am
Location: Auch, SW France
Contact:

#2 Post by ian » Sun Aug 15, 2004 3:48 pm

If you're happy about taking the unit apart, you can disconnect the front button from the actuating mechanism behind it - frankly I would re-learn how I picked up the laptop before buggering abound with the cd drive...
Ian at thinkpads dot com

spotter
Sophomore Member
Posts: 125
Joined: Thu Jul 08, 2004 3:00 pm
Location: New York, NY

#3 Post by spotter » Mon Aug 16, 2004 11:31 pm

just make a short program that locks the cd drive.

here's one for linux, just compile and name as cd-lock and cd-unlock.

Code: Select all

#include <sys/ioctl.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/cdrom.h>
#include <string.h>
#include <libgen.h>

int main(int argc, char *argv[])
{
        int fd;
        int lock;

        char *cmd1;

        cmd1 = basename(argv[0]);

        if (!strcmp(cmd1, "cd-lock"))
                lock = 1;
        else if (!strcmp(cmd1, "cd-unlock"))
                lock = 0;
        else {
                printf("program must be called cd-lock or cd-unlock\n");
                return 1;
        }

        if (argc != 2)
                fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
        else
                fd = open(argv[1], O_RDONLY | O_NONBLOCK);

        if ( fd < 0 )
        {
                perror("open failed");
                return 3;
        }

        if (ioctl(fd, CDROM_LOCKDOOR, lock)) {
                perror("ioctl failed");
                return 4;
        }

        return 0;
}

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “ThinkPad T4x Series”

Who is online

Users browsing this forum: No registered users and 6 guests