⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ide-cd

📁 Linux内核源代码 为压缩文件 是<<Linux内核>>一书中的源代码
💻
📖 第 1 页 / 共 2 页
字号:
    adding `append="hdX=noprobe hdX=cdrom"' to your lilo.conf file and running     lilo (again where X is the drive letter corresponding to where your drive     is installed.)    c. System hangups.  - If the system locks up when you try to access the CDROM, the most    likely cause is that you have a buggy IDE adapter which doesn't    properly handle simultaneous transactions on multiple interfaces.    The most notorious of these is the CMD640B chip.  This problem can    be worked around by specifying the `serialize' option when    booting.  Recent kernels should be able to detect the need for    this automatically in most cases, but the detection is not    foolproof.  See Documentation/ide.txt for more information    about the `serialize' option and the CMD640B.  - Note that many MS-DOS CDROM drivers will work with such buggy    hardware, apparently because they never attempt to overlap CDROM    operations with other disk activity.d. Can't mount a CDROM.  - If you get errors from mount, it may help to check `dmesg' to see    if there are any more specific errors from the driver or from the    filesystem.  - Make sure there's a CDROM loaded in the drive, and that's it's an    ISO 9660 disc.  You can't mount an audio CD.  - With the CDROM in the drive and unmounted, try something like      cat /dev/cdrom | od | more    If you see a dump, then the drive and driver are probably working    OK, and the problem is at the filesystem level (i.e., the CDROM is    not ISO 9660 or has errors in the filesystem structure).  - If you see `not a block device' errors, check that the definitions    of the device special files are correct.  They should be as    follows:      brw-rw----   1 root     disk       3,   0 Nov 11 18:48 /dev/hda      brw-rw----   1 root     disk       3,  64 Nov 11 18:48 /dev/hdb      brw-rw----   1 root     disk      22,   0 Nov 11 18:48 /dev/hdc      brw-rw----   1 root     disk      22,  64 Nov 11 18:48 /dev/hdd    Some early Slackware releases had these defined incorrectly.  If    these are wrong, you can remake them by running the script    scripts/MAKEDEV.ide.  (You may have to make it executable    with chmod first.)    If you have a /dev/cdrom symbolic link, check that it is pointing    to the correct device file.    If you hear people talking of the devices `hd1a' and `hd1b', these    were old names for what are now called hdc and hdd.  Those names    should be considered obsolete.  - If mount is complaining that the iso9660 filesystem is not    available, but you know it is (check /proc/filesystems), you    probably need a newer version of mount.  Early versions would not    always give meaningful error messages.e. Directory listings are unpredictably truncated, and `dmesg' shows   `buffer botch' error messages from the driver.  - There was a bug in the version of the driver in 1.2.x kernels    which could cause this.  It was fixed in 1.3.0.  If you can't    upgrade, you can probably work around the problem by specifying a    blocksize of 2048 when mounting.  (Note that you won't be able to    directly execute binaries off the CDROM in that case.)    If you see this in kernels later than 1.3.0, please report it as a    bug.f. Data corruption.  - Random data corruption was occasionally observed with the Hitachi    CDR-7730 CDROM. If you experience data corruption, using "hdx=slow"    as a command line parameter may work around the problem, at the    expense of low system performance.6. cdchange.c-------------/* * cdchange.c  [-v]  <device>  [<slot>] * * This loads a CDROM from a specified slot in a changer, and displays  * information about the changer status.  The drive should be unmounted before  * using this program. * * Changer information is displayed if either the -v flag is specified * or no slot was specified. * * Based on code originally from Gerhard Zuber <zuber@berlin.snafu.de>. * Changer status information, and rewrite for the new Uniform CDROM driver * interface by Erik Andersen <andersee@debian.org>. */#include <stdio.h>#include <stdlib.h>#include <errno.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <sys/ioctl.h>#include <linux/cdrom.h>intmain (int argc, char **argv){	char *program;	char *device;	int fd;           /* file descriptor for CD-ROM device */	int status;       /* return status for system calls */	int verbose = 0;	int slot=-1, x_slot;	int total_slots_available;	program = argv[0];	++argv;	--argc;	if (argc < 1 || argc > 3) {		fprintf (stderr, "usage: %s [-v] <device> [<slot>]\n",			 program);		fprintf (stderr, "       Slots are numbered 1 -- n.\n");		exit (1);	}        if (strcmp (argv[0], "-v") == 0) {                verbose = 1;                ++argv;                --argc;        } 	device = argv[0]; 	if (argc == 2)		slot = atoi (argv[1]) - 1;	/* open device */ 	fd = open(device, O_RDONLY | O_NONBLOCK);	if (fd < 0) {		fprintf (stderr, "%s: open failed for `%s': %s\n",			 program, device, strerror (errno));		exit (1);	}	/* Check CD player status */ 	total_slots_available = ioctl (fd, CDROM_CHANGER_NSLOTS);	if (total_slots_available <= 1 ) {		fprintf (stderr, "%s: Device `%s' is not an ATAPI "			"compliant CD changer.\n", program, device);		exit (1);	}	if (slot >= 0) {		if (slot >= total_slots_available) {			fprintf (stderr, "Bad slot number.  "				 "Should be 1 -- %d.\n",				 total_slots_available);			exit (1);		}		/* load */ 		slot=ioctl (fd, CDROM_SELECT_DISC, slot);		if (slot<0) {			fflush(stdout);				perror ("CDROM_SELECT_DISC ");			exit(1);		}	}	if (slot < 0 || verbose) {		status=ioctl (fd, CDROM_SELECT_DISC, CDSL_CURRENT);		if (status<0) {			fflush(stdout);			perror (" CDROM_SELECT_DISC");			exit(1);		}		slot=status;		printf ("Current slot: %d\n", slot+1);		printf ("Total slots available: %d\n",			total_slots_available);		printf ("Drive status: ");                status = ioctl (fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);                if (status<0) {                  perror(" CDROM_DRIVE_STATUS");                } else switch(status) {		case CDS_DISC_OK:			printf ("Ready.\n");			break;		case CDS_TRAY_OPEN:			printf ("Tray Open.\n");			break;		case CDS_DRIVE_NOT_READY:			printf ("Drive Not Ready.\n");			break;		default:			printf ("This Should not happen!\n");			break;		}		for (x_slot=0; x_slot<total_slots_available; x_slot++) {			printf ("Slot %2d: ", x_slot+1);             		status = ioctl (fd, CDROM_DRIVE_STATUS, x_slot);             		if (status<0) {             		     perror(" CDROM_DRIVE_STATUS");             		} else switch(status) {			case CDS_DISC_OK:				printf ("Disc present.");				break;			case CDS_NO_DISC: 				printf ("Empty slot.");				break;			case CDS_TRAY_OPEN:				printf ("CD-ROM tray open.\n");				break;			case CDS_DRIVE_NOT_READY:				printf ("CD-ROM drive not ready.\n");				break;			case CDS_NO_INFO:				printf ("No Information available.");				break;			default:				printf ("This Should not happen!\n");				break;			}		  if (slot == x_slot) {                  status = ioctl (fd, CDROM_DISC_STATUS);                  if (status<0) {			perror(" CDROM_DISC_STATUS");                  }		  switch (status) {			case CDS_AUDIO:				printf ("\tAudio disc.\t");				break;			case CDS_DATA_1:			case CDS_DATA_2:				printf ("\tData disc type %d.\t", status-CDS_DATA_1+1);				break;			case CDS_XA_2_1:			case CDS_XA_2_2:				printf ("\tXA data disc type %d.\t", status-CDS_XA_2_1+1);				break;			default:				printf ("\tUnknown disc type 0x%x!\t", status);				break;			}			}                  	status = ioctl (fd, CDROM_MEDIA_CHANGED, x_slot);                  	if (status<0) {				perror(" CDROM_MEDIA_CHANGED");                  	}		  	switch (status) {			case 1:				printf ("Changed.\n");				break;			default:				printf ("\n");				break;			}		}	}	/* close device */	status = close (fd);	if (status != 0) {		fprintf (stderr, "%s: close failed for `%s': %s\n",			 program, device, strerror (errno));		exit (1);	} 	exit (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -