1 /* @(#)scsi_mmc4.c	1.6 09/07/10 Copyright 2002-2009 J. Schilling */
2 #include <schily/mconfig.h>
3 #ifndef lint
4 static	UConst char sccsid[] =
5 	"@(#)scsi_mmc4.c	1.6 09/07/10 Copyright 2002-2000 J. Schilling";
6 #endif
7 /*
8  *	SCSI command functions for cdrecord
9  *	covering MMC-4 level and above
10  *
11  *	Copyright (c) 2002-2009 J. Schilling
12  */
13 /*
14  * The contents of this file are subject to the terms of the
15  * Common Development and Distribution License, Version 1.0 only
16  * (the "License").  You may not use this file except in compliance
17  * with the License.
18  *
19  * See the file CDDL.Schily.txt in this distribution for details.
20  * A copy of the CDDL is also available via the Internet at
21  * http://www.opensource.org/licenses/cddl1.txt
22  *
23  * When distributing Covered Code, include this CDDL HEADER in each
24  * file and include the License file CDDL.Schily.txt from this distribution.
25  */
26 
27 /* #define	DEBUG */
28 #include <schily/mconfig.h>
29 
30 #include <schily/stdio.h>
31 #include <schily/standard.h>
32 #include <schily/stdlib.h>
33 #include <schily/unistd.h>
34 #include <schily/fcntl.h>
35 #include <schily/errno.h>
36 #include <schily/string.h>
37 #include <schily/time.h>
38 
39 #include <schily/utypes.h>
40 #include <schily/btorder.h>
41 #include <schily/intcvt.h>
42 #include <schily/schily.h>
43 
44 #include <scg/scgcmd.h>
45 #include <scg/scsidefs.h>
46 #include <scg/scsireg.h>
47 #include <scg/scsitransp.h>
48 
49 #include "scsimmc.h"
50 #include "cdrecord.h"
51 
52 EXPORT  int	get_supported_cdrw_media_types	__PR((SCSI *scgp));
53 
54 /*
55  * Retrieve list of supported cd-rw media types (feature 0x37)
56  */
57 EXPORT int
get_supported_cdrw_media_types(scgp)58 get_supported_cdrw_media_types(scgp)
59     SCSI    *scgp;
60 {
61 	Uchar   cbuf[16];
62 	int	ret;
63 	fillbytes(cbuf, sizeof (cbuf), '\0');
64 
65 	scgp->silent++;
66 	ret = get_configuration(scgp, (char *)cbuf, sizeof (cbuf), 0x37, 2);
67 	scgp->silent--;
68 
69 	if (ret < 0)
70 		return (-1);
71 
72 	if (cbuf[3] < 12)	/* Couldn't retrieve feature 0x37	*/
73 		return (-1);
74 
75 	return (int)(cbuf[13]);
76 }
77