4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #include <sys/types.h>
37 #include <dbus/dbus.h>
38 #include <hal/libhal.h>
40 #include "transport.h"
45 #include "misc_scsi.h"
50 * Old sun drives have a vendor specific mode page for setting/getting speed.
51 * Also they use a different method for extracting audio.
52 * We have the device inquiry strings at this time. This is used to enable
53 * us to use older sun drives to extract audio.
56 is_old_sun_drive(cd_device
*dev
)
59 * If we have a SONY CDU 561, CDU 8012, or TOSHIBA model with XMa we
60 * need to handle these drives a bit differently.
62 if (strncmp("SONY", (const char *)&dev
->d_inq
[8], 4) == 0) {
63 if (strncmp("CDU 561", (const char *)&dev
->d_inq
[16], 7) == 0)
65 if (strncmp("CDU-8012", (const char *)&dev
->d_inq
[16], 8) == 0)
69 if ((strncmp("TOSHIBA", (const char *)&dev
->d_inq
[8], 7) == 0) &&
70 (strncmp("XM", (const char *)&dev
->d_inq
[16], 2) == 0)) {
74 /* Changing speed is not allowed for 32X TOSHIBA drives */
75 if (strncmp("SUN32XCD", (const char *)&dev
->d_inq
[24], 8) == 0)
76 dev
->d_cap
|= DEV_CAP_SETTING_SPEED_NOT_ALLOWED
;
77 (void) strncpy(product_id
, (const char *)&dev
->d_inq
[16], 16);
79 if (strstr(product_id
, "SUN") != NULL
)
86 * returns a cd_device handle for a node returned by lookup_device()
87 * also takes the user supplied name and stores it inside the node
90 get_device(char *user_supplied
, char *node
)
95 char devnode
[PATH_MAX
];
97 struct dk_minfo mediainfo
;
101 * we need to resolve any link paths to avoid fake files
102 * such as /dev/rdsk/../../export/file.
105 TRACE(traceall_msg("get_device(%s, %s)\n", user_supplied
?
106 user_supplied
: "<nil>", node
? node
: "<nil>"));
108 size
= resolvepath(node
, devnode
, PATH_MAX
);
109 if ((size
<= 0) || (size
>= (PATH_MAX
- 1)))
112 /* resolvepath may not return a null terminated string */
113 devnode
[size
] = '\0';
116 /* the device node must be in /devices/ or /vol/dev/rdsk */
118 if ((strncmp(devnode
, "/devices/", 9) != 0) &&
119 (strncmp(devnode
, "/vol/dev/rdsk", 13) != 0))
122 * Since we are currently running with the user euid it is
123 * safe to try to open the file without checking access.
126 fd
= open(devnode
, O_RDONLY
|O_NDELAY
);
129 TRACE(traceall_msg("Cannot open %s: %s\n", node
,
134 dev
= (cd_device
*)my_zalloc(sizeof (cd_device
));
136 dev
->d_node
= (char *)my_zalloc(strlen(devnode
) + 1);
137 (void) strcpy(dev
->d_node
, devnode
);
141 dev
->d_inq
= (uchar_t
*)my_zalloc(INQUIRY_DATA_LENGTH
);
143 if (!inquiry(fd
, dev
->d_inq
)) {
144 TRACE(traceall_msg("Inquiry failed on device %s\n", node
));
146 (void) printf("USCSI ioctl failed %d\n",
151 (void) close(dev
->d_fd
);
157 cap
= (uchar_t
*)my_zalloc(18);
158 (void) printf("Checking device type\n");
159 if (get_mode_page(fd
, 0x2A, 0, 8, cap
)) {
161 (void) printf("DVD-R read support\n");
163 (void) printf("DVD-R write support\n");
165 (void) printf("R-W supported\n");
167 (void) printf("DVD-RAM read supported\n");
169 (void) printf("DVD-RAM write supported\n");
171 (void) printf("Could not read mode page 2A! \n");
176 /* Detect if it's a Lite-ON drive with a streaming CD problem */
177 if ((strncmp("LITE-ON", (const char *)&dev
->d_inq
[8], 7) == 0) &&
178 (strncmp("LTR-48", (const char *)&dev
->d_inq
[16], 6) == 0)) {
183 * a workaround for the firmware problem in LITE-ON COMBO drives.
184 * streaming for these drives sets it only to max speed regardless
185 * of requested speed. cd_speed_ctrl allow speeds less than max
186 * to be set but not max thus the code below. (x48 is max speed
189 if ((strncmp("LITE-ON", (const char *)&dev
->d_inq
[8], 7) == 0) &&
190 (strncmp("COMBO SOHC-4836VS",
191 (const char *)&dev
->d_inq
[16], 17) == 0))
192 if (requested_speed
< 48)
195 cap
= (uchar_t
*)my_zalloc(8);
196 if (is_old_sun_drive(dev
)) {
197 dev
->d_read_audio
= toshiba_read_audio
;
198 dev
->d_speed_ctrl
= toshiba_speed_ctrl
;
201 * If the CD Read Feature is supported, READ CD will work
202 * and will return jitter free audio data. Otherwise, look
203 * at Page Code 2A for this information.
205 if (ftr_supported(fd
, MMC_FTR_CD_READ
) == 1) {
206 dev
->d_read_audio
= read_audio_through_read_cd
;
207 dev
->d_cap
|= DEV_CAP_ACCURATE_CDDA
;
208 } else if (get_mode_page(fd
, 0x2A, 0, 8, cap
)) {
210 dev
->d_read_audio
= read_audio_through_read_cd
;
212 dev
->d_cap
|= DEV_CAP_ACCURATE_CDDA
;
216 * If the Real Time Streaming Feature is supported then
217 * Real-time streaming commands can be used for speed control
218 * (except when we want to use cd_speed_ctrl explicitly which
219 * is specified by setting use_cd_speed to 1).
220 * Otherwise try SET CD SPEED.
222 if ((ftr_supported(fd
, MMC_FTR_RT_STREAM
) == 1) &&
224 dev
->d_speed_ctrl
= rt_streaming_ctrl
;
226 (void) printf("using rt speed ctrl\n");
228 dev
->d_speed_ctrl
= cd_speed_ctrl
;
230 (void) printf("using cd speed ctrl\n");
233 if (dev
->d_read_audio
!= NULL
)
234 dev
->d_cap
|= DEV_CAP_EXTRACT_CDDA
;
239 * Find the block size of the device so we can translate
240 * the reads/writes to the device blocksize.
243 if (ioctl(fd
, DKIOCGMEDIAINFO
, &mediainfo
) < 0) {
245 * If DKIOCGMEDIAINFO fails we'll try to get
246 * the blocksize from the device itself.
249 (void) printf("DKIOCGMEDIAINFO failed\n");
250 if (read_capacity(fd
, cap
))
251 dev
->d_blksize
= read_scsi32(cap
+ 4);
254 dev
->d_blksize
= mediainfo
.dki_lbsize
;
260 (void) printf("blocksize = %d\n", dev
->d_blksize
);
261 (void) printf("read_format_capacity = %d \n",
262 read_format_capacity(fd
, &bsize
));
266 * Some devices will return invalid blocksizes. ie. Toshiba
267 * drives will return 2352 when an audio CD is inserted.
268 * Older Sun drives will use 512 byte block sizes. All newer
269 * drives should have 2k blocksizes.
271 if (((dev
->d_blksize
!= 512) && (dev
->d_blksize
!= 2048))) {
272 if (is_old_sun_drive(dev
)) {
273 dev
->d_blksize
= 512;
275 dev
->d_blksize
= 2048;
278 (void) printf(" switching to %d\n", dev
->d_blksize
);
283 dev
->d_name
= (char *)my_zalloc(strlen(user_supplied
) + 1);
284 (void) strcpy(dev
->d_name
, user_supplied
);
286 TRACE(traceall_msg("Got device %s\n", node
));
291 fini_device(cd_device
*dev
)
295 (void) close(dev
->d_fd
);
301 * Given a /dev path resolve that path to a symbolic
302 * name such as cdrom0 if hald is running. If hald is
303 * not running, or does not have a symbolic name for the
304 * the specified /dev path return NULL.
307 hald_symname(char *path
)
309 LibHalContext
*ctx
= NULL
;
312 char **udi
, *p
= NULL
;
315 /* Make sure hald is running */
316 if (vol_running
== 0)
319 dbus_error_init(&error
);
321 if ((ctx
= attach_to_hald()) == NULL
)
324 if ((udi
= libhal_manager_find_device_string_match(ctx
,
325 HAL_RDSK_PROP
, path
, &ndevs
, &error
)) == NULL
)
328 /* Look for the node that contains the valid (non-null) symdev */
329 for (i
= 0; i
< ndevs
; i
++) {
330 if ((p
= libhal_device_get_property_string(ctx
, udi
[i
],
331 HAL_SYMDEV_PROP
, NULL
)) != NULL
)
334 libhal_free_string(p
);
339 libhal_free_string_array(udi
);
340 if (dbus_error_is_set(&error
))
341 dbus_error_free(&error
);
342 detach_from_hald(ctx
, HAL_INITIALIZED
);
347 * Given a name resolve that name to a raw device in the case
348 * that it is a symbolic name or just return what is given if
349 * we are given a /dev path or hald is not running.
352 hald_findname(char *symname
)
354 LibHalContext
*ctx
= NULL
;
357 char **udi
, *path
= NULL
;
361 * We already have a raw path lets return it in a copied buffer
362 * as our caller assumes that they need to free memory.
364 if (symname
[0] == '/') {
365 path
= my_zalloc(strlen(symname
) + 1);
366 (void) strlcpy(path
, symname
, (strlen(symname
) + 1));
370 /* Get the raw device from the hal record */
371 if (vol_running
!= 0) {
372 dbus_error_init(&error
);
374 if ((ctx
= attach_to_hald()) == NULL
)
377 if ((udi
= libhal_manager_find_device_string_match(ctx
,
378 HAL_SYMDEV_PROP
, symname
, &ndevs
,
383 * Loop over the returned UDIs to access the raw
386 for (i
= 0; i
< ndevs
; i
++) {
387 if ((path
= libhal_device_get_property_string(ctx
,
388 udi
[i
], HAL_RDSK_PROP
, NULL
)) != NULL
)
391 libhal_free_string(path
);
396 libhal_free_string_array(udi
);
397 if (dbus_error_is_set(&error
))
398 dbus_error_free(&error
);
399 detach_from_hald(ctx
, HAL_INITIALIZED
);
407 vol_name_to_dev_node(char *vname
, char *found
)
416 p1
= hald_findname(vname
);
420 if (stat(p1
, &statbuf
) < 0) {
421 libhal_free_string(p1
);
424 if (S_ISDIR(statbuf
.st_mode
)) {
425 for (i
= 0; i
< 16; i
++) {
426 (void) snprintf(found
, PATH_MAX
, "%s/s%d", p1
, i
);
427 if (access(found
, F_OK
) >= 0)
431 libhal_free_string(p1
);
435 (void) strlcpy(found
, p1
, PATH_MAX
);
437 libhal_free_string(p1
);
442 * Builds an open()able device path from a user supplied node which can be
443 * of the * form of /dev/[r]dsk/cxtxdx[sx] or cxtxdx[sx] or volmgt-name like
445 * returns the path found in 'found' and returns 1. Otherwise returns 0.
448 lookup_device(char *supplied
, char *found
)
452 char tmpstr
[PATH_MAX
];
454 /* If everything is fine and proper, no need to analyze */
455 if ((stat(supplied
, &statbuf
) == 0) && S_ISCHR(statbuf
.st_mode
) &&
456 ((fd
= open(supplied
, O_RDONLY
|O_NDELAY
)) >= 0)) {
458 (void) strlcpy(found
, supplied
, PATH_MAX
);
463 * Hal only allows access to a device when the user is
464 * on the console, therefore if hal is running and we can't
465 * open the /dev/rdsk or /dev/removable-media/rdsk device
466 * file we will return 0 marking this device as not avaiable.
468 if (fd
< 0 && ((strncmp(supplied
, "/dev/rdsk/", 10) == 0) ||
469 (strncmp(supplied
, "/dev/removable-media/rdsk/", 26) == 0)))
472 if ((strncmp(supplied
, "/dev/dsk/", 9) == 0) ||
473 (strncmp(supplied
, "/dev/removable-media/dsk/", 25) == 0)) {
474 (void) snprintf(tmpstr
, PATH_MAX
, "/dev/rdsk/%s",
475 (char *)strrchr(supplied
, '/'));
477 if ((fd
= open(tmpstr
, O_RDONLY
|O_NDELAY
)) >= 0) {
479 (void) strlcpy(found
, supplied
, PATH_MAX
);
483 /* This device can't be opened mark it as unavailable. */
486 if ((strncmp(supplied
, "cdrom", 5) != 0) &&
487 (strlen(supplied
) < 32)) {
488 (void) snprintf(tmpstr
, sizeof (tmpstr
), "/dev/rdsk/%s",
490 if (access(tmpstr
, F_OK
) < 0) {
491 (void) strcat(tmpstr
, "s2");
493 if ((fd
= open(tmpstr
, O_RDONLY
|O_NDELAY
)) >= 0) {
495 (void) strlcpy(found
, tmpstr
, PATH_MAX
);
499 /* This device can't be opened mark it as unavailable. */
502 return (vol_name_to_dev_node(supplied
, found
));
506 * Opens the device node name passed and returns 1 (true) if the
514 struct dk_cinfo cinfo
;
517 fd
= open(node
, O_RDONLY
|O_NDELAY
);
520 } else if (ioctl(fd
, DKIOCINFO
, &cinfo
) < 0) {
522 } else if (cinfo
.dki_ctype
!= DKC_CDROM
) {
535 /* l10n_NOTE : Column spacing should be kept same */
536 (void) printf(gettext(" Node Connected Device"));
537 /* l10n_NOTE : Column spacing should be kept same */
538 (void) printf(gettext(" Device type\n"));
540 "----------------------+--------------------------------");
541 (void) printf("+-----------------\n");
545 * returns the number of writers or CD/DVD-roms found and the path of
546 * the first device found depending on the mode argument.
547 * possible mode values are:
548 * SCAN_ALL_CDS Scan all CD/DVD devices. Return first CD-RW found.
549 * SCAN_WRITERS Scan all CD-RW devices. Return first one found.
550 * SCAN_LISTDEVS List all devices found.
553 scan_for_cd_device(int mode
, cd_device
**found
)
556 struct dirent
*dirent
;
557 char sdev
[PATH_MAX
], dev
[PATH_MAX
];
559 int writers_found
= 0;
560 int header_printed
= 0;
562 int total_devices_found
;
564 TRACE(traceall_msg("scan_for_cd_devices (mode=%d) called\n", mode
));
567 (void) printf(gettext("Looking for CD devices...\n"));
570 dir
= opendir("/dev/rdsk");
575 total_devices_found
= 0;
576 while ((dirent
= readdir(dir
)) != NULL
) {
577 if (dirent
->d_name
[0] == '.')
579 (void) snprintf(sdev
, PATH_MAX
, "/dev/rdsk/%s",
581 if (strcmp("s2", (char *)strrchr(sdev
, 's')) != 0)
583 if (!lookup_device(sdev
, dev
))
587 if ((t_dev
= get_device(NULL
, dev
)) == NULL
) {
590 total_devices_found
++;
592 is_writer
= !(check_device(t_dev
, CHECK_DEVICE_NOT_WRITABLE
));
597 if ((writers_found
== 1) && (mode
!= SCAN_LISTDEVS
)) {
601 } else if ((mode
== SCAN_ALL_CDS
) && (writers_found
== 0) &&
602 (total_devices_found
== 1) && found
) {
604 /* We found a CD-ROM or DVD-ROM */
608 if (mode
== SCAN_LISTDEVS
) {
611 sn
= hald_symname(sdev
);
612 if (!header_printed
) {
616 /* show vendor, model, firmware rev and device type */
617 (void) printf(" %-21.21s| %.8s %.16s %.4s | %s%s\n",
618 sn
? sn
: sdev
, &t_dev
->d_inq
[8],
619 &t_dev
->d_inq
[16], &t_dev
->d_inq
[32],
620 gettext("CD Reader"),
621 is_writer
? gettext("/Writer") : "");
624 if ((found
!= NULL
) && ((*found
) != t_dev
))
628 (void) closedir(dir
);
630 if ((mode
& SCAN_WRITERS
) || writers_found
)
631 return (writers_found
);
633 return (total_devices_found
);
637 * Check device for various conditions/capabilities
638 * If EXIT_IF_CHECK_FAILED set in cond then it will also exit after
639 * printing a message.
642 check_device(cd_device
*dev
, int cond
)
644 uchar_t
*disc_info
, disc_status
= 0, erasable
= 0;
645 uchar_t page_code
[4];
648 if ((errmsg
== NULL
) && (cond
& CHECK_TYPE_NOT_CDROM
) &&
649 ((dev
->d_inq
[0] & 0x1f) != 5)) {
651 gettext("Specified device does not appear to be a CDROM");
654 if ((errmsg
== NULL
) && (cond
& CHECK_DEVICE_NOT_READY
) &&
655 !test_unit_ready(dev
->d_fd
)) {
656 errmsg
= gettext("Device not ready");
659 /* Look at the capabilities page for this information */
660 if ((errmsg
== NULL
) && (cond
& CHECK_DEVICE_NOT_WRITABLE
)) {
661 if (!get_mode_page(dev
->d_fd
, 0x2a, 0, 4, page_code
) ||
662 ((page_code
[3] & 1) == 0)) {
663 errmsg
= gettext("Target device is not a CD writer");
667 if ((errmsg
== NULL
) && (cond
& CHECK_NO_MEDIA
)) {
668 if (!test_unit_ready(dev
->d_fd
) && (uscsi_status
== 2) &&
669 ((RQBUFLEN
- rqresid
) >= 14) &&
670 ((SENSE_KEY(rqbuf
) & 0x0f) == 2) && (ASC(rqbuf
) == 0x3A) &&
671 ((ASCQ(rqbuf
) == 0) || (ASCQ(rqbuf
) == 1) ||
672 (ASCQ(rqbuf
) == 2))) {
673 /* medium not present */
674 errmsg
= gettext("No media in device");
680 /* Issue READ DISC INFORMATION mmc command */
681 if ((errmsg
== NULL
) && ((cond
& CHECK_MEDIA_IS_NOT_BLANK
) ||
682 (cond
& CHECK_MEDIA_IS_NOT_WRITABLE
) ||
683 (cond
& CHECK_MEDIA_IS_NOT_ERASABLE
))) {
685 disc_info
= (uchar_t
*)my_zalloc(DISC_INFO_BLOCK_SIZE
);
686 if (!read_disc_info(dev
->d_fd
, disc_info
)) {
687 errmsg
= gettext("Cannot obtain disc information");
689 disc_status
= disc_info
[2] & 0x03;
690 erasable
= disc_info
[2] & 0x10;
693 if (errmsg
== NULL
) {
694 if (!erasable
&& (cond
& CHECK_MEDIA_IS_NOT_ERASABLE
))
696 "Media in the device is not erasable");
697 else if ((disc_status
!= 0) &&
698 (cond
& CHECK_MEDIA_IS_NOT_BLANK
))
700 "Media in the device is not blank");
701 else if ((disc_status
== 2) &&
702 (cond
& CHECK_MEDIA_IS_NOT_WRITABLE
) &&
703 ((device_type
!= DVD_PLUS_W
) &&
704 (device_type
!= DVD_PLUS
)))
706 "Media in the device is not writable");
711 if (cond
& EXIT_IF_CHECK_FAILED
) {
712 err_msg("%s.\n", errmsg
);
721 * Generic routine for writing whatever the next track is and taking
722 * care of the progress bar. Mode tells the track type (audio or data).
723 * Data from track is taken from the byte stream h
726 write_next_track(int mode
, bstreamhandle h
)
728 struct track_info
*ti
;
729 struct trackio_error
*te
;
732 ti
= (struct track_info
*)my_zalloc(sizeof (*ti
));
733 if ((build_track_info(target
, -1, ti
) == 0) ||
734 ((ti
->ti_flags
& TI_NWA_VALID
) == 0)) {
735 if ((device_type
== DVD_PLUS
) || (device_type
==
737 ti
->ti_flags
|= TI_NWA_VALID
;
740 "Cannot get writable address for the media.\n"));
744 if (ti
->ti_nwa
!= ti
->ti_start_address
) {
746 "Media state is not suitable for this write mode.\n"));
749 if (mode
== TRACK_MODE_DATA
) {
750 if (!(ti
->ti_track_mode
& 4)) {
751 /* Write track depends upon this bit */
752 ti
->ti_track_mode
|= TRACK_MODE_DATA
;
756 h
->bstr_size(h
, &size
);
758 te
= (struct trackio_error
*)my_zalloc(sizeof (*te
));
760 print_n_flush(gettext("Writing track %d..."), (int)ti
->ti_track_no
);
762 if (!write_track(target
, ti
, h
, progress
, size
, te
)) {
763 if (te
->err_type
== TRACKIO_ERR_USER_ABORT
) {
764 (void) str_print(gettext("Aborted.\n"), progress_pos
);
766 if (device_type
!= DVD_PLUS_W
) {
767 /* l10n_NOTE : 'failed' as in Writing Track...failed */
768 (void) str_print(gettext("failed.\n"),
773 /* l10n_NOTE : 'done' as in "Writing track 1...done" */
774 (void) str_print(gettext("done.\n"), progress_pos
);
782 if (scan_for_cd_device(SCAN_LISTDEVS
, NULL
) == 0) {
785 "No CD writers found, no media in the drive "
786 "or not on the console.\n"));
790 "Volume manager is not running.\n"));
792 "Please start volume manager or run cdrw as root to access all devices.\n"));
794 err_msg(gettext("No CD writers found.\n"));
802 get_media_type(int fd
)
804 uchar_t
*cap
= (uchar_t
*)my_zalloc(MMC_FTR_HDR_LEN
);
806 if (get_configuration(fd
, MMC_FTR_PRFL_LIST
,
807 MMC_FTR_HDR_LEN
, cap
)) {
809 (void) print_profile_list(fd
);
810 switch (read_scsi16(&cap
[6])) {
811 case 0x8: /* CD-ROM */
813 (void) printf("CD-ROM found\n");
815 * To avoid regression issues, treat as
816 * A cdrw, we will check the writable
817 * mode page to see if the media is
825 (void) printf("CD-R found\n");
829 case 0x10: /* DVD-ROM */
831 * Have seen drives return DVD+RW media
832 * DVD-ROM, so try treating it as a DVD+RW
833 * profile. checking for writable media
834 * is done through mode page 5.
837 (void) printf("DVD-ROM found\n");
838 device_type
= DVD_PLUS_W
;
841 case 0xA: /* CD-RW */
843 (void) printf("CD-RW found\n");
847 case 0x11: /* DVD-R */
849 (void) printf("DVD-R found\n");
850 device_type
= DVD_MINUS
;
853 case 0x12: /* DVD-RAM */
855 (void) printf("DVD-RAM found\n");
856 /* treat as CD-RW, may be a legacy drive */
860 case 0x13: /* DVD-RW restricted overwrite */
861 case 0x14: /* DVD-RW sequential */
863 (void) printf("DVD-RW found\n");
864 device_type
= DVD_MINUS
;
867 case 0x15: /* DVD-R Dual Layer Sequential Recording */
868 case 0x16: /* DVD-R Dual Layer Jump Recording */
870 (void) printf("DVD-R DL found\n");
871 device_type
= DVD_MINUS
;
874 case 0x17: /* DVD-RW Dual Layer */
876 (void) printf("DVD-RW DL found\n");
877 device_type
= DVD_MINUS
;
880 case 0x1A: /* DVD+RW */
882 (void) printf("DVD+RW found\n");
884 device_type
= DVD_PLUS_W
;
887 case 0x1B: /* DVD+R */
889 (void) printf("DVD+R found\n");
890 device_type
= DVD_PLUS
;
893 case 0x2A: /* DVD+RW Dual Layer */
895 (void) printf("DVD+RW DL found\n");
896 device_type
= DVD_PLUS_W
;
899 case 0x2B: /* DVD+R Dual Layer */
901 (void) printf("DVD+R DL found\n");
902 device_type
= DVD_PLUS
;
908 "unknown drive found\n type = 0x%x",
911 * Treat as CD_RW to avoid regression, may
920 /* Translate a transfer rate (eg, KB/s) into a Speed (eg, "2X") */
922 cdrw_bandwidth_to_x(uint_t rate
)
924 switch (device_type
) {
928 return (DVD_RATE_TO_X(rate
));
932 return (CD_RATE_TO_X(rate
));
936 /* Translate a Speed (eg, "2X") into a transfer rate (eg, KB/s) */
938 cdrw_x_to_bandwidth(uint_t x
)
940 switch (device_type
) {
944 return (DVD_X_TO_RATE(x
));
948 return (CD_X_TO_RATE(x
));