[brasero] Added a header for INQUIRY command
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Added a header for INQUIRY command
- Date: Sun, 2 Aug 2009 11:43:01 +0000 (UTC)
commit b6a97c677af43d9ddcaf89de19afe226f7dfbb7d
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Sat Aug 1 14:30:35 2009 +0200
Added a header for INQUIRY command
libbrasero-media/Makefile.am | 3 +-
libbrasero-media/scsi-inquiry.c | 32 +++++++--
libbrasero-media/scsi-inquiry.h | 136 +++++++++++++++++++++++++++++++++++
libbrasero-media/scsi-mech-status.h | 2 +-
4 files changed, 166 insertions(+), 7 deletions(-)
---
diff --git a/libbrasero-media/Makefile.am b/libbrasero-media/Makefile.am
index d2885d2..a4b5712 100644
--- a/libbrasero-media/Makefile.am
+++ b/libbrasero-media/Makefile.am
@@ -124,7 +124,8 @@ libbrasero_media_la_SOURCES = \
brasero-gio-operation.h \
brasero-gio-operation.c \
scsi-inquiry.c \
- scsi-prevent-allow-medium-removal.c
+ scsi-prevent-allow-medium-removal.c \
+ scsi-inquiry.h
# FreeBSD's SCSI CAM interface
if HAVE_CAM_LIB_H
diff --git a/libbrasero-media/scsi-inquiry.c b/libbrasero-media/scsi-inquiry.c
index 8a8fb64..bd63f0e 100644
--- a/libbrasero-media/scsi-inquiry.c
+++ b/libbrasero-media/scsi-inquiry.c
@@ -37,6 +37,7 @@
#include "scsi-base.h"
#include "scsi-command.h"
#include "scsi-opcodes.h"
+#include "scsi-inquiry.h"
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
@@ -83,19 +84,40 @@ BRASERO_SCSI_COMMAND_DEFINE (BraseroInquiryCDB,
BRASERO_SCSI_READ);
BraseroScsiResult
+brasero_spc1_inquiry (BraseroDeviceHandle *handle,
+ BraseroScsiInquiry *hdr,
+ BraseroScsiErrCode *error)
+{
+ BraseroInquiryCDB *cdb;
+ BraseroScsiResult res;
+
+ cdb = brasero_scsi_command_new (&info, handle);
+ cdb->alloc_len = sizeof (BraseroScsiInquiry);
+
+ memset (hdr, 0, sizeof (BraseroScsiInquiry));
+ res = brasero_scsi_command_issue_sync (cdb,
+ hdr,
+ sizeof (BraseroScsiInquiry),
+ error);
+ brasero_scsi_command_free (cdb);
+ return res;
+}
+
+BraseroScsiResult
brasero_spc1_inquiry_is_optical_drive (BraseroDeviceHandle *handle,
BraseroScsiErrCode *error)
{
BraseroInquiryCDB *cdb;
- uchar data [36] = {0, };
+ BraseroScsiInquiry hdr;
BraseroScsiResult res;
cdb = brasero_scsi_command_new (&info, handle);
- cdb->alloc_len = sizeof (data);
+ cdb->alloc_len = sizeof (hdr);
+ memset (&hdr, 0, sizeof (hdr));
res = brasero_scsi_command_issue_sync (cdb,
- data,
- sizeof (data),
+ &hdr,
+ sizeof (hdr),
error);
brasero_scsi_command_free (cdb);
@@ -103,7 +125,7 @@ brasero_spc1_inquiry_is_optical_drive (BraseroDeviceHandle *handle,
return res;
/* NOTE: 0x05 is for CD/DVD players */
- return (data [0] & 0x1F) == 0x05? BRASERO_SCSI_OK:BRASERO_SCSI_RECOVERABLE;
+ return hdr.type == 0x05? BRASERO_SCSI_OK:BRASERO_SCSI_RECOVERABLE;
}
diff --git a/libbrasero-media/scsi-inquiry.h b/libbrasero-media/scsi-inquiry.h
new file mode 100644
index 0000000..31afcf1
--- /dev/null
+++ b/libbrasero-media/scsi-inquiry.h
@@ -0,0 +1,136 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-media
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-media is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-media authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-media. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-media is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-media is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _SCSI_MECH_STATUS_H
+#define _SCSI_MECH_STATUS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+
+struct _BraseroScsiInquiry {
+ uchar type :5;
+ uchar qualifier :3;
+
+ uchar reserved0 :7;
+ uchar rmb :1;
+
+ uchar ansi_ver :3;
+ uchar ecma_ver :3;
+ uchar iso_ver :2;
+
+ uchar response_format :4;
+ uchar reserved1 :1;
+ uchar norm_aca :1;
+ uchar trmtsk :1;
+ uchar aerc :1;
+
+ uchar add_len;
+
+ uchar reserved2;
+
+ uchar addr16 :1;
+ uchar addr32 :1;
+ uchar ack_req :1;
+ uchar mchngr :1;
+ uchar multiP :1;
+ uchar vs1 :1;
+ uchar enc_serv :1;
+ uchar reserved3 :1;
+
+ uchar vs2 :1;
+ uchar cmd_queue :1;
+ uchar transdis :1;
+ uchar linked :1;
+ uchar sync :1;
+ uchar wbus16 :1;
+ uchar wbus32 :1;
+ uchar rel_addr :1;
+
+ uchar vendor [8];
+ uchar name [8];
+ uchar revision [8];
+};
+
+#else
+
+struct _BraseroScsiInquiry {
+ uchar qualifier :3;
+ uchar type :5;
+
+ uchar rmb :1;
+ uchar reserved0 :7;
+
+ uchar iso_ver :2;
+ uchar ecma_ver :3;
+ uchar ansi_ver :3;
+
+ uchar aerc :1;
+ uchar trmtsk :1;
+ uchar norm_aca :1;
+ uchar reserved1 :1;
+ uchar response_format :4;
+
+ uchar add_len;
+
+ uchar reserved2;
+
+ uchar reserved3 :1;
+ uchar enc_serv :1;
+ uchar vs1 :1;
+ uchar multiP :1;
+ uchar mchngr :1;
+ uchar ack_req :1;
+ uchar addr32 :1;
+ uchar addr16 :1;
+
+ uchar rel_addr :1;
+ uchar wbus32 :1;
+ uchar wbus16 :1;
+ uchar sync :1;
+ uchar linked :1;
+ uchar transdis :1;
+ uchar cmd_queue :1;
+ uchar vs2 :1;
+
+ uchar vendor [8];
+ uchar name [8];
+ uchar revision [8];
+};
+
+#endif
+
+typedef struct _BraseroScsiInquiry BraseroScsiInquiry;
+
+G_END_DECLS
+
+#endif
diff --git a/libbrasero-media/scsi-mech-status.h b/libbrasero-media/scsi-mech-status.h
index d080749..ecd09e2 100644
--- a/libbrasero-media/scsi-mech-status.h
+++ b/libbrasero-media/scsi-mech-status.h
@@ -27,7 +27,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
-
+
#ifndef _SCSI_MECH_STATUS_H
#define _SCSI_MECH_STATUS_H
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]