summaryrefslogtreecommitdiff
path: root/sysutils/k3b/patches/patch-an
blob: b03e01da5c936661dd18f6b20150588a72e7c1eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$NetBSD: patch-an,v 1.1.1.1 2006/02/01 00:53:00 markd Exp $

--- libk3bdevice/k3bscsicommand_bsd.cpp.orig	2005-12-16 02:08:38.000000000 +1300
+++ libk3bdevice/k3bscsicommand_bsd.cpp
@@ -190,3 +190,35 @@ int K3bDevice::ScsiCommand::transport( T
 
   return ret;
 }
+
+bool K3bDevice::ScsiCommand::eject ( bool b )
+{
+  d->cmd.cmd[0] = MMC_START_STOP_UNIT;
+
+  if ( b ) {
+    // Since all other eject methods I saw also start the unit before ejecting
+    // we do it also although I don't know why...
+    d->cmd.cmd[4] = 0x1;      // Start unit
+    transport();
+
+    d->cmd.cmd[4] = 0x2;    // LoEj = 1, Start = 0
+  }
+  else
+    d->cmd.cmd[4] = 0x3;    // LoEj = 1, Start = 1
+    
+  return !transport();
+
+}
+
+bool K3bDevice::ScsiCommand::traylock ( bool on )
+{
+  d->cmd.cmd[0] = MMC_PREVENT_ALLOW_MEDIUM_REMOVAL;
+  if( on )
+    d->cmd.cmd[4] = 0x01;
+  int r = transport();
+
+  if( r )
+    kdDebug() << "(K3bDevice::Device) MMC ALLOW MEDIA REMOVAL failed." << endl;
+
+  return ( r == 0 );
+}