Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package sedutil for openSUSE:Factory checked 
in at 2022-12-05 18:01:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/sedutil (Old)
 and      /work/SRC/openSUSE:Factory/.sedutil.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "sedutil"

Mon Dec  5 18:01:31 2022 rev:3 rq:1040148 version:1.20.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/sedutil/sedutil.changes  2020-08-20 
22:29:34.104002077 +0200
+++ /work/SRC/openSUSE:Factory/.sedutil.new.1835/sedutil.changes        
2022-12-05 18:01:40.464736208 +0100
@@ -1,0 +2,12 @@
+Sun Dec  4 12:16:10 UTC 2022 - Dirk Müller <[email protected]>
+
+- update to 1.20.0:
+  * Bug fixes and Windows Ryzen Fix.
+  * checkpoint: before new Identify.
+  * Fix typos for PSID revert text
+  * Fix PIN dump in --query output 
+  * Minor updates to linuxpba.
+  * Disable acpi & apic for better compatibility.
+  * Add cherry keyboard support.
+
+-------------------------------------------------------------------

Old:
----
  1.15.1.tar.gz

New:
----
  1.20.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ sedutil.spec ++++++
--- /var/tmp/diff_new_pack.Y5au1h/_old  2022-12-05 18:01:41.056739432 +0100
+++ /var/tmp/diff_new_pack.Y5au1h/_new  2022-12-05 18:01:41.064739475 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package sedutil
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,22 +18,21 @@
 
 %define _dracutmodulesdir %{_prefix}/lib/dracut/modules.d
 Name:           sedutil
-Version:        1.15.1
+Version:        1.20.0
 Release:        0
 Summary:        Tools to manage the activation and use of self encrypting 
drives
 License:        GPL-3.0-or-later
 Group:          System/Management
-Url:            https://github.com/Drive-Trust-Alliance/sedutil/wiki
+URL:            https://github.com/Drive-Trust-Alliance/sedutil/wiki
 Source0:        
https://github.com/Drive-Trust-Alliance/%{name}/archive/%{version}.tar.gz
 Source1:        module-setup.sh
 Source2:        linuxpba.sh
 Source3:        sedutil-pba.pl
+Patch0:         kernel_nvme_header.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  gcc-c++
 BuildRequires:  ncurses-devel
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Patch:          kernel_nvme_header.patch
 ExclusiveArch:  x86_64
 
 %description
@@ -47,12 +46,12 @@
 
 %prep
 %setup -q
-%patch -p1
+%patch0 -p1
 
 %build
 autoreconf -fi
 %configure
-make %{?_smp_mflags}
+%make_build
 
 %install
 %make_install 
@@ -63,10 +62,9 @@
 install -m 0755 %{SOURCE3} %{buildroot}%{_sbindir}/
 
 %files
-%defattr(-,root,root)
 %doc README.md Common/Copyright.txt Common/ReadMe.txt 
linux/PSIDRevert_LINUX.txt
 %license Common/LICENSE.txt
-%{_mandir}/man8/sedutil-cli.8*
+%{_mandir}/man8/sedutil-cli.8%{?ext_man}
 %{_sbindir}/sedutil-cli
 %{_sbindir}/linuxpba
 %dir %{_prefix}/lib/dracut

++++++ 1.15.1.tar.gz -> 1.20.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/.vscode/c_cpp_properties.json 
new/sedutil-1.20.0/.vscode/c_cpp_properties.json
--- old/sedutil-1.15.1/.vscode/c_cpp_properties.json    1970-01-01 
01:00:00.000000000 +0100
+++ new/sedutil-1.20.0/.vscode/c_cpp_properties.json    2021-08-18 
14:18:03.000000000 +0200
@@ -0,0 +1,14 @@
+{
+  "configurations": [
+    {
+      "name": "Linux",
+      "includePath" : 
["${workspaceFolder}/Common/**","${workspaceFolder}/linux/**","${workspaceFolder}/LinuxPBA/**"
 ],
+      "defines": [],
+      "compilerPath": "/usr/bin/gcc",
+      "cStandard": "c11",
+      "cppStandard": "c++17",
+      "intelliSenseMode": "linux-gcc-x64"
+    }
+  ],
+  "version": 4
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/.vscode/launch.json 
new/sedutil-1.20.0/.vscode/launch.json
--- old/sedutil-1.15.1/.vscode/launch.json      1970-01-01 01:00:00.000000000 
+0100
+++ new/sedutil-1.20.0/.vscode/launch.json      2021-08-18 14:18:03.000000000 
+0200
@@ -0,0 +1,31 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: 
https://go.microsoft.com/fwlink/?linkid=830387
+
+        "version": "0.2.0",
+        "configurations": [
+
+          {
+            "name": "sedutil_debug",
+            "type": "cppdbg",
+            "request": "launch",
+            "program": "sedutil-cli",
+            "args": ["--query","/dev/sda"],
+            "stopAtEntry": false,
+            "cwd": "${workspaceFolder}",
+            "environment": [],
+            "externalConsole": false,
+            "MIMode": "gdb",
+            "setupCommands": [
+              {
+                "description": "Enable pretty-printing for gdb",
+                "text": "-enable-pretty-printing",
+                "ignoreFailures": true
+              }
+            ],
+            "preLaunchTask": "sedutil_build",
+            "miDebuggerPath": "/usr/bin/gdb"
+          }
+        ]
+      }
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/.vscode/settings.json 
new/sedutil-1.20.0/.vscode/settings.json
--- old/sedutil-1.15.1/.vscode/settings.json    1970-01-01 01:00:00.000000000 
+0100
+++ new/sedutil-1.20.0/.vscode/settings.json    2021-08-18 14:18:03.000000000 
+0200
@@ -0,0 +1,5 @@
+{
+    "editor.fontSize": 18,
+    "editor.cursorStyle": "block",
+    "editor.accessibilityPageSize": 18
+}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/.vscode/tasks.json 
new/sedutil-1.20.0/.vscode/tasks.json
--- old/sedutil-1.15.1/.vscode/tasks.json       1970-01-01 01:00:00.000000000 
+0100
+++ new/sedutil-1.20.0/.vscode/tasks.json       2021-08-18 14:18:03.000000000 
+0200
@@ -0,0 +1,38 @@
+{
+    "version": "2.0.0",
+    "tasks": [
+      {
+        "type": "shell",
+        "label": "sedutil_build",
+        "command": "make",
+        "options": {"cwd": "${workspaceFolder}"},
+        "args": [
+          "V=0",
+          "CFLAGS='-g -Og'",
+          "CXXFLAGS='-g -Og'",
+          "sedutil-cli"
+        ],
+        "problemMatcher": [
+          "$gcc"
+        ],
+        "group": {
+          "kind": "build",
+          "isDefault": true         }
+      },
+      {
+        "type": "shell",
+        "label": "clean ",
+        "command": "make",
+        "args": [
+          "clean"
+        ],
+        "problemMatcher": [
+          "$gcc"
+        ],
+        
+      }
+
+    ]
+  }
+  
+  
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/BUILDING new/sedutil-1.20.0/BUILDING
--- old/sedutil-1.15.1/BUILDING 1970-01-01 01:00:00.000000000 +0100
+++ new/sedutil-1.20.0/BUILDING 2021-08-18 14:18:03.000000000 +0200
@@ -0,0 +1,11 @@
+sedutil is built using autotools and make.
+steps:
+autoreconf -i
+./configure --enable-silent-rules
+make
+------------------------
+This will also build the PBA ignore it.
+
+If you get an errot building that says Version.h is missing
+you need to make all. This is an issue with how autotools handles
+built sources and dependencies. 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/Common/DtaAnnotatedDump.h 
new/sedutil-1.20.0/Common/DtaAnnotatedDump.h
--- old/sedutil-1.15.1/Common/DtaAnnotatedDump.h        2017-08-22 
02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/Common/DtaAnnotatedDump.h        2021-08-18 
14:18:03.000000000 +0200
@@ -20,7 +20,7 @@
 
 #pragma pack(push,1)
 
-typedef union
+typedef union CAtomHeader_t
 {
     // four bytes in big endian (network) byte order
     uint8_t     all[4];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/Common/DtaDev.cpp 
new/sedutil-1.20.0/Common/DtaDev.cpp
--- old/sedutil-1.15.1/Common/DtaDev.cpp        2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/Common/DtaDev.cpp        2021-08-18 14:18:03.000000000 
+0200
@@ -288,8 +288,8 @@
        if (disk_info.OPAL20) {
                cout << "OPAL 2.0 function (" << HEXON(4) << FC_OPALV200 << ")" 
<< HEXOFF << std::endl;
                cout << "    Base comID = " << HEXON(4) << 
disk_info.OPAL20_basecomID << HEXOFF;
-               cout << ", Initial PIN = " << HEXON(2) << 
disk_info.OPAL20_initialPIN << HEXOFF;
-               cout << ", Reverted PIN = " << HEXON(2) << 
disk_info.OPAL20_revertedPIN << HEXOFF;
+               cout << ", Initial PIN = " << HEXON(2) << 
static_cast<uint32_t>(disk_info.OPAL20_initialPIN) << HEXOFF;
+               cout << ", Reverted PIN = " << HEXON(2) << 
static_cast<uint32_t>(disk_info.OPAL20_revertedPIN) << HEXOFF;
                cout << ", comIDs = " << disk_info.OPAL20_numcomIDs;
                cout << std::endl;
                cout << "    Locking Admins = " << disk_info.OPAL20_numAdmins;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/Common/DtaOptions.cpp 
new/sedutil-1.20.0/Common/DtaOptions.cpp
--- old/sedutil-1.15.1/Common/DtaOptions.cpp    2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/Common/DtaOptions.cpp    2021-08-18 14:18:03.000000000 
+0200
@@ -126,6 +126,7 @@
                        loggingLevel += (uint16_t)(strlen(argv[i]) - 1);
                        if (loggingLevel > 7) loggingLevel = 7;
                        CLog::Level() = CLog::FromInt(loggingLevel);
+                       RCLog::Level() = RCLog::FromInt(loggingLevel);
                        LOG(D) << "Log level set to " << 
CLog::ToString(CLog::FromInt(loggingLevel));
                        LOG(D) << "sedutil version : " << GIT_VERSION;
                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/Common/DtaStructures.h 
new/sedutil-1.20.0/Common/DtaStructures.h
--- old/sedutil-1.15.1/Common/DtaStructures.h   2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/Common/DtaStructures.h   2021-08-18 14:18:03.000000000 
+0200
@@ -351,6 +351,19 @@
     uint8_t modelNum[40];
 } IDENTIFY_RESPONSE;
 
+typedef struct _UASP_INQUIRY_RESPONSE {
+       uint8_t fill1[20];
+       char ProductSerial[20];
+       uint8_t fill2[6];
+       char ProductRev[8];
+       char ProductID[40];
+} UASP_INQUIRY_RESPONSE;
+
+typedef struct _SCSI_INQUIRY_RESPONSE {
+       uint8_t fill1[16];
+       char ProductID[16];
+       char ProductRev[4];
+} SCSI_INQUIRY_RESPONSE;
 
 
 
////////////////////////////////////////////////////////////////////////////////
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/LinuxPBA/LinuxPBA.cpp 
new/sedutil-1.20.0/LinuxPBA/LinuxPBA.cpp
--- old/sedutil-1.15.1/LinuxPBA/LinuxPBA.cpp    2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/LinuxPBA/LinuxPBA.cpp    2021-08-18 14:18:03.000000000 
+0200
@@ -23,6 +23,7 @@
 #include <sys/reboot.h>
 #include <iostream>
 #include "log.h"
+#include "DtaOptions.h"
 #include "GetPassPhrase.h"
 #include "UnlockSEDs.h"
 
@@ -33,7 +34,8 @@
 
 int main(int argc, char** argv) {
     
-    CLog::Level() = CLog::FromInt(0);
+    CLog::Level() = CLog::FromInt(2);
+    RCLog::Level() = CLog::FromInt(2);
     LOG(D4) << "Legacy PBA start" << endl;
 //    system ("tput clear");
     printf("DTA LINUX Pre Boot Authorization \n");
@@ -42,6 +44,7 @@
     if (strcmp(p.c_str(), "debug")) {
         printf("Starting OS \n");
         sync();
+        usleep(5000000); // give the user time to see results
         reboot(RB_AUTOBOOT);
     }
     return 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/Makefile.am 
new/sedutil-1.20.0/Makefile.am
--- old/sedutil-1.15.1/Makefile.am      2017-08-22 02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/Makefile.am      2021-08-18 14:18:03.000000000 +0200
@@ -1,47 +1,55 @@
 AUTOMAKE_OPTIONS = foreign subdir-objects
 AM_CFLAGS = -Wall -Werror -std=c11
-AM_CXXFLAGS = -Wall -Werror -std=c++11 -I./Common -I./Common/pbkdf2 -I./linux 
-I./LinuxPBA
-SEDUTIL_COMMON_CODE = \
-       Common/DtaAnnotatedDump.cpp Common/DtaAnnotatedDump.h \
-       Common/DtaCommand.cpp Common/DtaCommand.h \
-       Common/DtaDev.cpp Common/DtaDev.h \
-       Common/DtaDevEnterprise.cpp Common/DtaDevEnterprise.h \
-       Common/DtaDevGeneric.cpp Common/DtaDevGeneric.h \
-       Common/DtaDevOpal1.cpp Common/DtaDevOpal1.h \
-       Common/DtaDevOpal2.cpp Common/DtaDevOpal2.h \
-       Common/DtaDevOpal.cpp Common/DtaDevOpal.h \
-       Common/DtaDiskType.cpp Common/DtaDiskType.h \
-       Common/DtaHashPwd.cpp Common/DtaHashPwd.h \
-       Common/DtaHexDump.cpp Common/DtaHexDump.h \
-       Common/DtaResponse.cpp Common/DtaResponse.h \
-       Common/DtaSession.cpp Common/DtaSession.h \
-       Common/DtaStructures.h Common/log.h Common/DtaLexicon.h 
Common/DtaConstants.h Common/DtaEndianFixup.h \
-       Common/pbkdf2/blockwise.c Common/pbkdf2/blockwise.h 
Common/pbkdf2/chash.c Common/pbkdf2/chash.h Common/pbkdf2/handy.h \
-       Common/pbkdf2/hmac.c Common/pbkdf2/hmac.h Common/pbkdf2/pbkdf2.c 
Common/pbkdf2/pbkdf2.h Common/pbkdf2/sha1.c \
-       Common/pbkdf2/sha1.h Common/pbkdf2/tassert.h Common/pbkdf2/bitops.h
+AM_CXXFLAGS = -Wall -Werror -std=c++11 -I./linux -I$(srcdir)/Common 
-I$(srcdir)/Common/pbkdf2 -I$(srcdir)/linux -I$(srcdir)/LinuxPBA
+SEDUTIL_COMMON_CODE = Common/log.h \
+       Common/DtaEndianFixup.h Common/DtaStructures.h \
+       Common/DtaLexicon.h Common/DtaConstants.h \
+       Common/DtaAnnotatedDump.cpp Common/DtaCommand.cpp \
+       Common/DtaAnnotatedDump.h Common/DtaCommand.h \
+       Common/DtaDev.cpp Common/DtaDevEnterprise.cpp \
+       Common/DtaDev.h Common/DtaDevEnterprise.h \
+       Common/DtaDevGeneric.cpp Common/DtaDevOpal1.cpp \
+       Common/DtaDevGeneric.h Common/DtaDevOpal1.h \
+       Common/DtaDevOpal2.cpp Common/DtaDevOpal.cpp \
+       Common/DtaDevOpal2.h Common/DtaDevOpal.h \
+       Common/DtaDiskType.cpp Common/DtaHashPwd.cpp \
+       Common/DtaDiskType.h Common/DtaHashPwd.h \
+       Common/DtaHexDump.cpp Common/DtaResponse.cpp \
+       Common/DtaHexDump.h Common/DtaResponse.h \
+       Common/DtaSession.cpp Common/pbkdf2/blockwise.c \
+       Common/DtaSession.h Common/pbkdf2/blockwise.h \
+       Common/pbkdf2/chash.c Common/pbkdf2/hmac.c \
+       Common/pbkdf2/chash.h Common/pbkdf2/hmac.h \
+       Common/pbkdf2/pbkdf2.c Common/pbkdf2/sha1.c \
+       Common/pbkdf2/pbkdf2.h Common/pbkdf2/sha1.h \
+       Common/pbkdf2/bitops.h Common/pbkdf2/blockwise.h \
+       Common/pbkdf2/handy.h Common/pbkdf2/tassert.h 
+SEDUTIL_LINUX_CODE = \
+       linux/Version.h linux/os.h linux/DtaDevLinuxDrive.h \
+       linux/DtaDevLinuxNvme.cpp linux/DtaDevLinuxSata.cpp \
+       linux/DtaDevLinuxNvme.h linux/DtaDevLinuxSata.h \
+       linux/DtaDevOS.cpp linux/DtaDevOS.h 
 sbin_PROGRAMS = sedutil-cli linuxpba
-sedutil_cli_SOURCES = linux/Version.h Common/sedutil.cpp Common/DtaOptions.cpp 
Common/DtaOptions.h \
-       \
-       linux/DtaDevLinuxNvme.cpp linux/DtaDevLinuxNvme.h \
-       linux/DtaDevLinuxSata.cpp linux/DtaDevLinuxSata.h \
-       linux/DtaDevOS.cpp linux/DtaDevOS.h \
-       linux/DtaDevLinuxDrive.h linux/os.h \
+sedutil_cli_SOURCES = Common/sedutil.cpp Common/DtaOptions.cpp \
+       Common/DtaOptions.h \
+       $(SEDUTIL_LINUX_CODE) \
        $(SEDUTIL_COMMON_CODE)
 CLEANFILES = linux/Version.h
 BUILT_SOURCES = linux/Version.h
 #
 linuxpba_SOURCES = LinuxPBA/LinuxPBA.cpp LinuxPBA/GetPassPhrase.cpp 
LinuxPBA/UnlockSEDs.cpp \
-        LinuxPBA/GetPassPhrase.h LinuxPBA/UnlockSEDs.h \
-       \
-       linux/DtaDevLinuxNvme.cpp linux/DtaDevLinuxNvme.h \
-       linux/DtaDevLinuxSata.cpp linux/DtaDevLinuxSata.h \
-       linux/DtaDevOS.cpp linux/DtaDevOS.h \
-       linux/DtaDevLinuxDrive.h linux/os.h \
-       \
+       LinuxPBA/GetPassPhrase.h LinuxPBA/UnlockSEDs.h \
+       $(SEDUTIL_LINUX_CODE) \
        $(SEDUTIL_COMMON_CODE)
 EXTRA_DIST = linux/GitVersion.sh linux/PSIDRevert_LINUX.txt linux/TestSuite.sh 
README.md docs/sedutil-cli.8
 man_MANS = docs/sedutil-cli.8
 linux/Version.h:
-       ./linux/GitVersion.sh > linux/Version.h
+       $(srcdir)/linux/GitVersion.sh > linux/Version.h
 .INTERMEDIATE: linux/Version.h
-
+maintainer-clean-local:
+       rm config.status configure config.log
+       rm Makefile
+       rm -r autom4te.cache/
+       rm aclocal.m4
+       rm compile install-sh missing Makefile.in
+       rm -rf depcomp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/README.md new/sedutil-1.20.0/README.md
--- old/sedutil-1.15.1/README.md        2017-08-22 02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/README.md        2021-08-18 14:18:03.000000000 +0200
@@ -24,10 +24,14 @@
 you to enable the locking in SED's that comply with the TCG OPAL 2.00
 standard on bios machines.   
 
-You must be administrator/root to run the host managment program
+You must be administrator/root to run the host management program
 
-In Linux libata.allow_tpm must be set to 1. Either via adding 
libata.allow_tpm=1 to the kernel flags at boot time 
-or changing the contents of /sys/module/libata/parameters/allow_tpm from a "0" 
to a "1" on a running system.
+In Linux libata.allow_tpm must be set to 1 for SATA-based drives,
+including NGFF/M.2 SATA drives.Either adding libata.allow_tpm=1
+to the kernel flags at boot time or changing the contents of
+/sys/module/libata/parameters/allow_tpm from a "0" to a "1" on
+a running system if possible will accomplish this. NVMe drives
+do not need this parameter.
 
 ***** sleep (S3) is not supported.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/configure.ac 
new/sedutil-1.20.0/configure.ac
--- old/sedutil-1.15.1/configure.ac     2017-08-22 02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/configure.ac     2021-08-18 14:18:03.000000000 +0200
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.69])
-AC_INIT([sedutil], [1.15.1], 
[https://github.com/Drive-Trust-Alliance/sedutil/issues])
+AC_INIT([sedutil], [1.20.0], 
[https://github.com/Drive-Trust-Alliance/sedutil/issues])
 AC_CONFIG_SRCDIR([Common/sedutil.cpp])
 AC_CONFIG_HEADERS([config.h])
 
@@ -28,6 +28,7 @@
 
 # use automake
 AM_INIT_AUTOMAKE([-Wall -Werror])
+AM_SILENT_RULES 
 AC_CONFIG_FILES([Makefile])
 
 AC_OUTPUT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/images/buildpbaroot 
new/sedutil-1.20.0/images/buildpbaroot
--- old/sedutil-1.15.1/images/buildpbaroot      2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/images/buildpbaroot      2021-08-18 14:18:03.000000000 
+0200
@@ -8,12 +8,17 @@
 cd scratch
 # clean up and start over
 rm -rf buildroot
-git clone ${BUILDROOT} || die
+git clone buildroot.git || die
 cd buildroot
 git checkout -b PBABUILD ${BUILDROOT_TAG}  || die
 git reset --hard
 git clean -df
+#add patches
+cd ..
+mkdir patches
+cp -r ../buildroot/patches/* patches/
 # add out of tree build directoried and files
+cd buildroot
 # 64 bit system
 mkdir 64bit
 cp ../../buildroot/64bit/.config 64bit/
@@ -27,10 +32,10 @@
 # add the current buildroot packages
 sed -i '/sedutil/d' package/Config.in
 sed -i '/menu "System tools"/a \\tsource "package/sedutil/Config.in"' 
package/Config.in
-cp -r ../../buildroot/packages/sedutil/ package/
+cp -r ../../buildroot/package/sedutil/ package/
 # Make a distribution from the current source
 cd ../../..
-autoreconf 
+autoreconf -i 
 ./configure
 make dist
 mkdir images/scratch/buildroot/dl/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/images/buildroot/32bit/.config 
new/sedutil-1.20.0/images/buildroot/32bit/.config
--- old/sedutil-1.15.1/images/buildroot/32bit/.config   2017-08-22 
02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/images/buildroot/32bit/.config   2021-08-18 
14:18:03.000000000 +0200
@@ -134,7 +134,7 @@
 BR2_SHARED_LIBS=y
 # BR2_SHARED_STATIC_LIBS is not set
 BR2_PACKAGE_OVERRIDE_FILE="$(CONFIG_DIR)/local.mk"
-BR2_GLOBAL_PATCH_DIR=""
+BR2_GLOBAL_PATCH_DIR="../patches"
 
 #
 # Advanced
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/images/buildroot/32bit/kernel.config 
new/sedutil-1.20.0/images/buildroot/32bit/kernel.config
--- old/sedutil-1.15.1/images/buildroot/32bit/kernel.config     2017-08-22 
02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/images/buildroot/32bit/kernel.config     2021-08-18 
14:18:03.000000000 +0200
@@ -4340,7 +4340,7 @@
 # CONFIG_HID_AUREAL is not set
 # CONFIG_HID_BELKIN is not set
 # CONFIG_HID_BETOP_FF is not set
-# CONFIG_HID_CHERRY is not set
+CONFIG_HID_CHERRY=y
 # CONFIG_HID_CHICONY is not set
 # CONFIG_HID_CORSAIR is not set
 # CONFIG_HID_CMEDIA is not set
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/images/buildroot/64bit/.config 
new/sedutil-1.20.0/images/buildroot/64bit/.config
--- old/sedutil-1.15.1/images/buildroot/64bit/.config   2017-08-22 
02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/images/buildroot/64bit/.config   2021-08-18 
14:18:03.000000000 +0200
@@ -119,7 +119,7 @@
 BR2_SHARED_LIBS=y
 # BR2_SHARED_STATIC_LIBS is not set
 BR2_PACKAGE_OVERRIDE_FILE="$(CONFIG_DIR)/local.mk"
-BR2_GLOBAL_PATCH_DIR=""
+BR2_GLOBAL_PATCH_DIR="../patches"
 
 #
 # Advanced
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/images/buildroot/64bit/kernel.config 
new/sedutil-1.20.0/images/buildroot/64bit/kernel.config
--- old/sedutil-1.15.1/images/buildroot/64bit/kernel.config     2017-08-22 
02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/images/buildroot/64bit/kernel.config     2021-08-18 
14:18:03.000000000 +0200
@@ -4340,7 +4340,7 @@
 # CONFIG_HID_AUREAL is not set
 # CONFIG_HID_BELKIN is not set
 # CONFIG_HID_BETOP_FF is not set
-# CONFIG_HID_CHERRY is not set
+CONFIG_HID_CHERRY=y
 # CONFIG_HID_CHICONY is not set
 # CONFIG_HID_CORSAIR is not set
 # CONFIG_HID_CMEDIA is not set
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sedutil-1.15.1/images/buildroot/package/sedutil/Config.in 
new/sedutil-1.20.0/images/buildroot/package/sedutil/Config.in
--- old/sedutil-1.15.1/images/buildroot/package/sedutil/Config.in       
1970-01-01 01:00:00.000000000 +0100
+++ new/sedutil-1.20.0/images/buildroot/package/sedutil/Config.in       
2021-08-18 14:18:03.000000000 +0200
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_SEDUTIL
+        bool "sedutil"
+       depends on BR2_INSTALL_LIBSTDCPP
+        help
+          This package provides support for Self Encrypting Drives (SEDs)
+
+          https://DriveTrust.com/
+          https://github.com/Drive-Trust-Alliance/sedutil
+
+comment "sedutil needs a toolchain w/ C++"
+       depends on !BR2_INSTALL_LIBSTDCPP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sedutil-1.15.1/images/buildroot/package/sedutil/sedutil.mk 
new/sedutil-1.20.0/images/buildroot/package/sedutil/sedutil.mk
--- old/sedutil-1.15.1/images/buildroot/package/sedutil/sedutil.mk      
1970-01-01 01:00:00.000000000 +0100
+++ new/sedutil-1.20.0/images/buildroot/package/sedutil/sedutil.mk      
2021-08-18 14:18:03.000000000 +0200
@@ -0,0 +1,25 @@
+################################################################################
+#
+# sedutil
+#
+################################################################################
+SEDUTIL_VERSION = 1.20.0
+SEDUTIL_SOURCE = sedutil-$(SEDUTIL_VERSION).tar.gz
+SEDUTIL_SITE = http://www.foosoftware.org/download
+SEDUTIL_INSTALL_STAGING = NO
+SEDUTIL_LIBTOOL_PATCH = NO
+SEDUTIL_INSTALL_TARGET = YES
+SEDUTIL_CONF_OPTS = --sbindir=/sbin
+SWDUTIL_MAKE=$(MAKE1)
+#SEDUTIL_DEPENDENCIES = libstdc++
+# Dont regen version header use the tarball version
+define SEDUTIL_POST_EXTRACT_ACTIONS
+sed -i '/^CLEANFILES/d' $(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.am
+sed -i '/^BUILT_SOURCES/d' $(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.am
+sed -i '/^linux\/Version/,3 d' 
$(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.am
+sed -i '/^BUILT_SOURCES/d' $(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.in
+sed -i '/^CLEANFILES/d' $(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.in
+sed -i '/^linux\/Version/,3 d' 
$(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.in
+endef
+SEDUTIL_POST_EXTRACT_HOOKS += SEDUTIL_POST_EXTRACT_ACTIONS
+$(eval $(autotools-package))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sedutil-1.15.1/images/buildroot/packages/sedutil/Config.in 
new/sedutil-1.20.0/images/buildroot/packages/sedutil/Config.in
--- old/sedutil-1.15.1/images/buildroot/packages/sedutil/Config.in      
2017-08-22 02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/images/buildroot/packages/sedutil/Config.in      
1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-config BR2_PACKAGE_SEDUTIL
-        bool "sedutil"
-       depends on BR2_INSTALL_LIBSTDCPP
-        help
-          This package provides support for Self Encrypting Drives (SEDs)
-
-          https://DriveTrust.com/
-          https://github.com/Drive-Trust-Alliance/sedutil
-
-comment "sedutil needs a toolchain w/ C++"
-       depends on !BR2_INSTALL_LIBSTDCPP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sedutil-1.15.1/images/buildroot/packages/sedutil/sedutil.mk 
new/sedutil-1.20.0/images/buildroot/packages/sedutil/sedutil.mk
--- old/sedutil-1.15.1/images/buildroot/packages/sedutil/sedutil.mk     
2017-08-22 02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/images/buildroot/packages/sedutil/sedutil.mk     
1970-01-01 01:00:00.000000000 +0100
@@ -1,25 +0,0 @@
-################################################################################
-#
-# sedutil
-#
-################################################################################
-SEDUTIL_VERSION = 1.15.1
-SEDUTIL_SOURCE = sedutil-$(SEDUTIL_VERSION).tar.gz
-SEDUTIL_SITE = http://www.foosoftware.org/download
-SEDUTIL_INSTALL_STAGING = NO
-SEDUTIL_LIBTOOL_PATCH = NO
-SEDUTIL_INSTALL_TARGET = YES
-SEDUTIL_CONF_OPTS = --sbindir=/sbin
-SWDUTIL_MAKE=$(MAKE1)
-#SEDUTIL_DEPENDENCIES = libstdc++
-# Dont regen version header use the tarball version
-define SEDUTIL_POST_EXTRACT_ACTIONS
-sed -i '/^CLEANFILES/d' $(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.am
-sed -i '/^BUILT_SOURCES/d' $(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.am
-sed -i '/^linux\/Version/,3 d' 
$(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.am
-sed -i '/^BUILT_SOURCES/d' $(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.in
-sed -i '/^CLEANFILES/d' $(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.in
-sed -i '/^linux\/Version/,3 d' 
$(BUILD_DIR)/sedutil-$(SEDUTIL_VERSION)/Makefile.in
-endef
-SEDUTIL_POST_EXTRACT_HOOKS += SEDUTIL_POST_EXTRACT_ACTIONS
-$(eval $(autotools-package))
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sedutil-1.15.1/images/buildroot/patches/m4/0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
 
new/sedutil-1.20.0/images/buildroot/patches/m4/0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
--- 
old/sedutil-1.15.1/images/buildroot/patches/m4/0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
       1970-01-01 01:00:00.000000000 +0100
+++ 
new/sedutil-1.20.0/images/buildroot/patches/m4/0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
       2021-08-18 14:18:03.000000000 +0200
@@ -0,0 +1,166 @@
+From 4af4a4a71827c0bc5e0ec67af23edef4f15cee8e Mon Sep 17 00:00:00 2001
+From: Paul Eggert <[email protected]>
+Date: Mon, 5 Mar 2018 10:56:29 -0800
+Subject: [PATCH] fflush: adjust to glibc 2.28 libio.h removal
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Problem reported by Daniel P. Berrangé in:
+https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
+* lib/fbufmode.c (fbufmode):
+* lib/fflush.c (clear_ungetc_buffer_preserving_position)
+(disable_seek_optimization, rpl_fflush):
+* lib/fpending.c (__fpending):
+* lib/fpurge.c (fpurge):
+* lib/freadable.c (freadable):
+* lib/freadahead.c (freadahead):
+* lib/freading.c (freading):
+* lib/freadptr.c (freadptr):
+* lib/freadseek.c (freadptrinc):
+* lib/fseeko.c (fseeko):
+* lib/fseterr.c (fseterr):
+* lib/fwritable.c (fwritable):
+* lib/fwriting.c (fwriting):
+Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
+* lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
+Define if not already defined.
+
+[[email protected]: partially backport from upstream gnulib]
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+
+---
+ lib/fflush.c     |  6 +++---
+ lib/fpending.c   |  2 +-
+ lib/fpurge.c     |  2 +-
+ lib/freadahead.c |  2 +-
+ lib/freading.c   |  2 +-
+ lib/fseeko.c     |  4 ++--
+ lib/stdio-impl.h |  6 ++++++
+ 7 files changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/lib/fflush.c b/build-aux/gnulib/lib/fflush.c
+index 983ade0ff..a6edfa105 100644
+--- a/lib/fflush.c
++++ b/lib/fflush.c
+@@ -33,7 +33,7 @@
+ #undef fflush
+ 
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
+ 
+ /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
+ static void
+@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
+ 
+ #endif
+ 
+-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */)
++#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */)
+ 
+ # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && 
defined __SNPT
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
+   if (stream == NULL || ! freading (stream))
+     return fflush (stream);
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
+ 
+   clear_ungetc_buffer_preserving_position (stream);
+ 
+diff --git a/lib/fpending.c b/build-aux/gnulib/lib/fpending.c
+index c84e3a5b4..789f50e4e 100644
+--- a/lib/fpending.c
++++ b/lib/fpending.c
+@@ -32,7 +32,7 @@ __fpending (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
+   return fp->_IO_write_ptr - fp->_IO_write_base;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android 
*/
+diff --git a/lib/fpurge.c b/build-aux/gnulib/lib/fpurge.c
+index b1d417c7a..3aedcc373 100644
+--- a/lib/fpurge.c
++++ b/lib/fpurge.c
+@@ -62,7 +62,7 @@ fpurge (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */
++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
+   fp->_IO_read_end = fp->_IO_read_ptr;
+   fp->_IO_write_ptr = fp->_IO_write_base;
+   /* Avoid memory leak when there is an active ungetc buffer.  */
+diff --git a/lib/freadahead.c b/build-aux/gnulib/lib/freadahead.c
+index c2ecb5b28..23ec76ee5 100644
+--- a/lib/freadahead.c
++++ b/lib/freadahead.c
+@@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *);
+ size_t
+ freadahead (FILE *fp)
+ {
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
+   if (fp->_IO_write_ptr > fp->_IO_write_base)
+     return 0;
+   return (fp->_IO_read_end - fp->_IO_read_ptr)
+diff --git a/lib/freading.c b/build-aux/gnulib/lib/freading.c
+index 73c28acdd..c24d0c88a 100644
+--- a/lib/freading.c
++++ b/lib/freading.c
+@@ -31,7 +31,7 @@ freading (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */
++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
+   return ((fp->_flags & _IO_NO_WRITES) != 0
+           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+               && fp->_IO_read_base != NULL));
+diff --git a/lib/fseeko.c b/build-aux/gnulib/lib/fseeko.c
+index 0101ab55f..193f4e8ce 100644
+--- a/lib/fseeko.c
++++ b/lib/fseeko.c
+@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
+ #endif
+ 
+   /* These tests are based on fpurge.c.  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
+   if (fp->_IO_read_end == fp->_IO_read_ptr
+       && fp->_IO_write_ptr == fp->_IO_write_base
+       && fp->_IO_save_base == NULL)
+@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
+           return -1;
+         }
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 
Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
+       fp->_flags &= ~_IO_EOF_SEEN;
+       fp->_offset = pos;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+diff --git a/lib/stdio-impl.h b/build-aux/gnulib/lib/stdio-impl.h
+index 78d896e9f..05c5752a2 100644
+--- a/lib/stdio-impl.h
++++ b/lib/stdio-impl.h
+@@ -18,6 +18,12 @@
+    the same implementation of stdio extension API, except that some fields
+    have different naming conventions, or their access requires some casts.  */
+ 
++/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
++   problem by defining it ourselves.  FIXME: Do not rely on glibc
++   internals.  */
++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
++# define _IO_IN_BACKUP 0x100
++#endif
+ 
+ /* BSD stdio derived implementations.  */
+ 
+-- 
+2.14.1
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sedutil-1.15.1/images/buildroot/patches/m4/0002-fflush-be-more-paranoid-about-libio.h-change.patch
 
new/sedutil-1.20.0/images/buildroot/patches/m4/0002-fflush-be-more-paranoid-about-libio.h-change.patch
--- 
old/sedutil-1.15.1/images/buildroot/patches/m4/0002-fflush-be-more-paranoid-about-libio.h-change.patch
      1970-01-01 01:00:00.000000000 +0100
+++ 
new/sedutil-1.20.0/images/buildroot/patches/m4/0002-fflush-be-more-paranoid-about-libio.h-change.patch
      2021-08-18 14:18:03.000000000 +0200
@@ -0,0 +1,151 @@
+From 74d9d6a293d7462dea8f83e7fc5ac792e956a0ad Mon Sep 17 00:00:00 2001
+From: Paul Eggert <[email protected]>
+Date: Thu, 8 Mar 2018 16:42:45 -0800
+Subject: [PATCH 2/2] fflush: be more paranoid about libio.h change
+
+Suggested by Eli Zaretskii in:
+https://lists.gnu.org/r/emacs-devel/2018-03/msg00270.html
+* lib/fbufmode.c (fbufmode):
+* lib/fflush.c (clear_ungetc_buffer_preserving_position)
+(disable_seek_optimization, rpl_fflush):
+* lib/fpending.c (__fpending):
+* lib/fpurge.c (fpurge):
+* lib/freadable.c (freadable):
+* lib/freadahead.c (freadahead):
+* lib/freading.c (freading):
+* lib/freadptr.c (freadptr):
+* lib/freadseek.c (freadptrinc):
+* lib/fseeko.c (fseeko):
+* lib/fseterr.c (fseterr):
+* lib/fwritable.c (fwritable):
+* lib/fwriting.c (fwriting):
+Look at _IO_ftrylockfile as well as at _IO_EOF_SEEN.
+---
+ lib/fflush.c     |  9 ++++++---
+ lib/fpending.c   |  3 ++-
+ lib/fpurge.c     |  3 ++-
+ lib/freadahead.c |  3 ++-
+ lib/freading.c   |  3 ++-
+ lib/fseeko.c     |  6 ++++--
+ 6 files changed, 18 insertions(+), 9 deletions(-)
+
+[[email protected]: partially backport from upstream gnulib]
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+
+diff --git a/lib/fflush.c b/build-aux/gnulib/lib/fflush.c
+index a6edfa105..a140b7ad9 100644
+--- a/lib/fflush.c
++++ b/lib/fflush.c
+@@ -33,7 +33,8 @@
+ #undef fflush
+ 
+ 
+-#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
++/* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+ /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
+ static void
+@@ -72,7 +73,8 @@ clear_ungetc_buffer (FILE *fp)
+ 
+ #endif
+ 
+-#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */)
++#if ! (defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 
1)
++/* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+ # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && 
defined __SNPT
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+@@ -148,7 +150,8 @@ rpl_fflush (FILE *stream)
+   if (stream == NULL || ! freading (stream))
+     return fflush (stream);
+ 
+-#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
++  /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+   clear_ungetc_buffer_preserving_position (stream);
+ 
+diff --git a/lib/fpending.c b/build-aux/gnulib/lib/fpending.c
+index 789f50e4e..7bc235ded 100644
+--- a/lib/fpending.c
++++ b/lib/fpending.c
+@@ -32,7 +32,8 @@ __fpending (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
++  /* GNU libc, BeOS, Haiku, Linux libc5 */
+   return fp->_IO_write_ptr - fp->_IO_write_base;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android 
*/
+diff --git a/lib/fpurge.c b/build-aux/gnulib/lib/fpurge.c
+index 3aedcc373..554790b56 100644
+--- a/lib/fpurge.c
++++ b/lib/fpurge.c
+@@ -62,7 +62,8 @@ fpurge (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
++# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
++  /* GNU libc, BeOS, Haiku, Linux libc5 */
+   fp->_IO_read_end = fp->_IO_read_ptr;
+   fp->_IO_write_ptr = fp->_IO_write_base;
+   /* Avoid memory leak when there is an active ungetc buffer.  */
+diff --git a/lib/freadahead.c b/build-aux/gnulib/lib/freadahead.c
+index 23ec76ee5..ed3dd0ebd 100644
+--- a/lib/freadahead.c
++++ b/lib/freadahead.c
+@@ -30,7 +30,8 @@ extern size_t __sreadahead (FILE *);
+ size_t
+ freadahead (FILE *fp)
+ {
+-#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
++  /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_write_ptr > fp->_IO_write_base)
+     return 0;
+   return (fp->_IO_read_end - fp->_IO_read_ptr)
+diff --git a/lib/freading.c b/build-aux/gnulib/lib/freading.c
+index c24d0c88a..790f92ca3 100644
+--- a/lib/freading.c
++++ b/lib/freading.c
+@@ -31,7 +31,8 @@ freading (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
++# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
++  /* GNU libc, BeOS, Haiku, Linux libc5 */
+   return ((fp->_flags & _IO_NO_WRITES) != 0
+           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+               && fp->_IO_read_base != NULL));
+diff --git a/lib/fseeko.c b/build-aux/gnulib/lib/fseeko.c
+index 193f4e8ce..e5c5172e7 100644
+--- a/lib/fseeko.c
++++ b/lib/fseeko.c
+@@ -47,7 +47,8 @@ fseeko (FILE *fp, off_t offset, int whence)
+ #endif
+ 
+   /* These tests are based on fpurge.c.  */
+-#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
++  /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_read_end == fp->_IO_read_ptr
+       && fp->_IO_write_ptr == fp->_IO_write_base
+       && fp->_IO_save_base == NULL)
+@@ -123,7 +124,8 @@ fseeko (FILE *fp, off_t offset, int whence)
+           return -1;
+         }
+ 
+-#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
++      /* GNU libc, BeOS, Haiku, Linux libc5 */
+       fp->_flags &= ~_IO_EOF_SEEN;
+       fp->_offset = pos;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+-- 
+2.14.1
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/images/buildroot/syslinux.cfg 
new/sedutil-1.20.0/images/buildroot/syslinux.cfg
--- old/sedutil-1.15.1/images/buildroot/syslinux.cfg    2017-08-22 
02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/images/buildroot/syslinux.cfg    2021-08-18 
14:18:03.000000000 +0200
@@ -4,4 +4,4 @@
 label DTA
     kernel bzImage
     initrd rootfs.cpio.xz
-    append loglevel=0 libata.allow_tpm=1 
+    append loglevel=0 libata.allow_tpm=1 acpi=off noapic 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/images/conf 
new/sedutil-1.20.0/images/conf
--- old/sedutil-1.15.1/images/conf      2017-08-22 02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/images/conf      2021-08-18 14:18:03.000000000 +0200
@@ -2,5 +2,6 @@
 #  Setup versions for image components
 #  This script should be sourced by the other scripts
 SYSLINUX=syslinux-6.03
-BUILDROOT=git://git.buildroot.net/buildroot
+#BUILDROOT=git://git.buildroot.net/buildroot
[email protected]:buildroot/buildroot.git
 BUILDROOT_TAG=2017.05.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/images/getresources 
new/sedutil-1.20.0/images/getresources
--- old/sedutil-1.15.1/images/getresources      2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/images/getresources      2021-08-18 14:18:03.000000000 
+0200
@@ -8,3 +8,4 @@
 cd scratch
 wget https://www.kernel.org/pub/linux/utils/boot/syslinux/${SYSLINUX}.tar.xz
 tar xf ${SYSLINUX}.tar.xz 
+git clone --bare ${BUILDROOT} buildroot.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/linux/DtaDevLinuxSata.cpp 
new/sedutil-1.20.0/linux/DtaDevLinuxSata.cpp
--- old/sedutil-1.15.1/linux/DtaDevLinuxSata.cpp        2017-08-22 
02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/linux/DtaDevLinuxSata.cpp        2021-08-18 
14:18:03.000000000 +0200
@@ -67,7 +67,7 @@
     LOG(D1) << "Creating DtaDevLinuxSata::DtaDev() " << devref;
        bool isOpen = FALSE;
 
-    if(access("/dev/sda", R_OK | W_OK)) {
+    if (access(devref, R_OK | W_OK)) {
         LOG(E) << "You do not have permission to access the raw disk in write 
mode";
         LOG(E) << "Perhaps you might try sudo to run as root";
     }
@@ -271,6 +271,9 @@
 
     if (!(memcmp(nullz.data(), buffer, 512))) {
         disk_info.devType = DEVICE_TYPE_OTHER;
+        // XXX: ioctl call was aborted or returned no data, most probably
+        //      due to driver not being libata based, let's try SAS instead.
+        identify_SAS(&disk_info);
         return;
     }
     IDENTIFY_RESPONSE * id = (IDENTIFY_RESPONSE *) buffer;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/linux/GitVersion.sh 
new/sedutil-1.20.0/linux/GitVersion.sh
--- old/sedutil-1.15.1/linux/GitVersion.sh      2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/linux/GitVersion.sh      2021-08-18 14:18:03.000000000 
+0200
@@ -1,5 +1,5 @@
 #!/bin/bash 
-set -x
+#set -x
 GIT=`which git`
 if [ "x"${GIT} == "x" ]; then
        echo "#define GIT_VERSION \"tarball\""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/linux/PSIDRevert_LINUX.txt 
new/sedutil-1.20.0/linux/PSIDRevert_LINUX.txt
--- old/sedutil-1.15.1/linux/PSIDRevert_LINUX.txt       2017-08-22 
02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/linux/PSIDRevert_LINUX.txt       2021-08-18 
14:18:03.000000000 +0200
@@ -7,13 +7,13 @@
 0.b chmod 0744 /sys/module/libata/parameters/allow_tpm
 0.b echo "1" > /sys/module/libata/parameters/allow_tpm
 
-1. setutil-cli --scan    <- SCAN to find Opal Drive (you should see Yes next 
the the drive
+1. sedutil-cli --scan    <- SCAN to find Opal Drive (you should see Yes next 
the the drive
                      your working with.
-2. setutil-cli --query /dev/sd? <--this will show the Opal status look at the 
locking
+2. sedutil-cli --query /dev/sd? <--this will show the Opal status look at the 
locking
                                                feature and see if it is Locked 
= Y
                                                or LockingEnabled = Y that's a 
good
                                                 sign that this should work
-3.setutil-cli --yesIreallywanttoERASEALLmydatausingthePSID 
<PSIDALLCAPSNODASHES> /dev/sd?
+3.sedutil-cli --yesIreallywanttoERASEALLmydatausingthePSID 
<PSIDALLCAPSNODASHES> /dev/sd?
 
 4.  You should see INFO: revertTper completed successfully.
     If you get a message that says NOT_AUTHORIZED you entered the PSID wrong.
@@ -21,7 +21,7 @@
 If it doesn't work please execute the command in step 3 with a -vvvvv (5 v's) 
as the first option
 redirecting the output to a file and send it back to me.
 example:
-setutil-cli -vvvvv --yesIreallywanttoERASEALLmydatausingthePSID 
<PSIDALLCAPSNODASHES> /dev/sd? > revertlog.txt
+sedutil-cli -vvvvv --yesIreallywanttoERASEALLmydatausingthePSID 
<PSIDALLCAPSNODASHES> /dev/sd? > revertlog.txt
 
 Hope this helps.
 ********************************************************************
@@ -31,7 +31,7 @@
 r0m30@r0m30-PC:~$ sudo -s
 root@r0m30-PC:~# chmod 0744 /sys/module/libata/parameters/allow_tpm
 root@r0m30-PC:~# echo "1" > /sys/module/libata/parameters/allow_tpm
-root@r0m30-PC:~# ./setutil-cli --scan
+root@r0m30-PC:~# ./sedutil-cli --scan
 
 Scanning for Opal 2.0 compliant disks
 /dev/sd0  No  ATA     KINGSTON SV100S21205 
@@ -44,7 +44,7 @@
 /dev/sd7  No  Generic-MS/MS-Pro       1.00 
 /dev/sd8  Yes ATA     Crucial_CT120M50MU05 
 No more disks present ending scan
-root@r0m30-PC:~# ./setutil-cli --query /dev/sd8
+root@r0m30-PC:~# ./sedutil-cli --query /dev/sd8
 /dev/sd8 ATA ATA     Crucial_CT120M50MU05 
 
 TPer function (0x0001)
@@ -60,7 +60,7 @@
 OPAL 2.0 function (0x0203)
     Base comID = 0x1000, Initial PIN = 0x0, Reverted PIN = 0x0, comIDs = 1
     Locking Admins = 4, Locking Users = 9, Range Crossing = N
-root@r0m30-PC:~# ./setutil-cli --yesIreallywanttoERASE*ALL*mydatausingthePSID 
<PSIDALLCAPSNODASHES> /dev/sd8
+root@r0m30-PC:~# ./sedutil-cli --yesIreallywanttoERASE*ALL*mydatausingthePSID 
<PSIDALLCAPSNODASHES> /dev/sd8
 - 01:14:10.996 INFO: Performing a PSID Revert on /dev/sd8 with password 
<PSIDALLCAPSNODASHES>
 - 01:14:11.165 INFO: revertTper completed successfully
 root@r0m30-PC:~# 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/linux/Package.sh 
new/sedutil-1.20.0/linux/Package.sh
--- old/sedutil-1.15.1/linux/Package.sh 2017-08-22 02:28:11.000000000 +0200
+++ new/sedutil-1.20.0/linux/Package.sh 2021-08-18 14:18:03.000000000 +0200
@@ -1,7 +1,18 @@
 #!/bin/bash
 rm sedutil_LINUX.tgz
-strip --strip-debug ./CLI/dist/Release_i686/GNU-Linux/sedutil-cli
-strip --strip-unneeded ./CLI/dist/Release_i686/GNU-Linux/sedutil-cli
-strip --strip-debug ./CLI/dist/Release_x86_64/GNU-Linux/sedutil-cli
-strip --strip-unneeded ./CLI/dist/Release_x86_64/GNU-Linux/sedutil-cli
-tar --xform 's,^,sedutil/,' -czf sedutil_LINUX.tgz *.txt TestSuite.sh ./*.txt 
../docs/* -C ./CLI/dist Release_i686/GNU-Linux/sedutil-cli 
Release_x86_64/GNU-Linux/sedutil-cli
+cd ..
+mkdir -p ./linux/CLI/dist/Release_i686/
+mkdir -p ./linux/CLI/dist/Release_x86_64/
+autoreconf -i
+./configure --enable-silent-rules
+make CFLAGS='-m32 -O2' CXXFLAGS='-m32 -O2' all
+cp sedutil-cli ./linux/CLI/dist/Release_i686/
+make clean
+make CFLAGS='-m64 -O2' CXXFLAGS='-m64 -O2' all
+cp sedutil-cli ./linux/CLI/dist/Release_x86_64/
+strip --strip-debug ./linux/CLI/dist/Release_i686/sedutil-cli
+strip --strip-unneeded ./linux/CLI/dist/Release_i686/sedutil-cli
+strip --strip-debug ./linux/CLI/dist/Release_x86_64/sedutil-cli
+strip --strip-unneeded ./linux/CLI/dist/Release_x86_64/sedutil-cli
+cd linux
+tar --xform 's,^,sedutil/,' -czf sedutil_LINUX.tgz *.txt TestSuite.sh ./*.txt 
../docs/* -C ./CLI/dist Release_i686/sedutil-cli Release_x86_64/sedutil-cli
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/windows/CLI/CLI.vcxproj 
new/sedutil-1.20.0/windows/CLI/CLI.vcxproj
--- old/sedutil-1.15.1/windows/CLI/CLI.vcxproj  2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/windows/CLI/CLI.vcxproj  2021-08-18 14:18:03.000000000 
+0200
@@ -159,6 +159,9 @@
       <SDLCheck>true</SDLCheck>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\;$(SolutionDir)..\..\common;$(SolutionDir)..\..\common\pbkdf2</AdditionalIncludeDirectories>
       <TreatWarningAsError>true</TreatWarningAsError>
+      <MinimalRebuild>false</MinimalRebuild>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -186,6 +189,9 @@
       <SDLCheck>true</SDLCheck>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\;$(SolutionDir)..\..\common;$(SolutionDir)..\..\common\pbkdf2</AdditionalIncludeDirectories>
       <TreatWarningAsError>true</TreatWarningAsError>
+      <MinimalRebuild>false</MinimalRebuild>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -215,6 +221,8 @@
       <SDLCheck>true</SDLCheck>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\;$(SolutionDir)..\..\common;$(SolutionDir)..\..\common\pbkdf2</AdditionalIncludeDirectories>
       <TreatWarningAsError>true</TreatWarningAsError>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -246,6 +254,8 @@
       <SDLCheck>true</SDLCheck>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\;$(SolutionDir)..\..\common;$(SolutionDir)..\..\common\pbkdf2</AdditionalIncludeDirectories>
       <TreatWarningAsError>true</TreatWarningAsError>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/windows/DtaDiskATA.cpp 
new/sedutil-1.20.0/windows/DtaDiskATA.cpp
--- old/sedutil-1.15.1/windows/DtaDiskATA.cpp   2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/windows/DtaDiskATA.cpp   2021-08-18 14:18:03.000000000 
+0200
@@ -37,11 +37,12 @@
 {
     LOG(D1) << "Creating DtaDiskATA::DtaDiskATA() " << devref;
     ATA_PASS_THROUGH_DIRECT * ata =
-            (ATA_PASS_THROUGH_DIRECT *) _aligned_malloc(sizeof 
(ATA_PASS_THROUGH_DIRECT), 8);
+            (ATA_PASS_THROUGH_DIRECT *) _aligned_malloc(sizeof 
(ATA_PASS_THROUGH_DIRECT), IO_BUFFER_ALIGNMENT);
     ataPointer = (void *) ata;
+
      hDev = CreateFile(devref,
-                      GENERIC_WRITE | GENERIC_READ,
-                      FILE_SHARE_WRITE | FILE_SHARE_READ,
+                      GENERIC_WRITE | GENERIC_READ | GENERIC_EXECUTE,
+                      FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
                       NULL,
                       OPEN_EXISTING,
                       0,
@@ -69,38 +70,37 @@
     memset(ata, 0, sizeof (ATA_PASS_THROUGH_DIRECT));
     ata->Length = sizeof (ATA_PASS_THROUGH_DIRECT);
     if (IF_RECV == cmd)
-        ata->AtaFlags = 0x00 | ATA_FLAGS_DRDY_REQUIRED | ATA_FLAGS_DATA_IN;
+        ata->AtaFlags = ATA_FLAGS_DATA_IN;
     else if (IDENTIFY == cmd)
         ata->AtaFlags = ATA_FLAGS_DATA_IN;
     else
-        ata->AtaFlags = 0x00 | ATA_FLAGS_DRDY_REQUIRED | ATA_FLAGS_DATA_OUT;
-
+        ata->AtaFlags = ATA_FLAGS_DATA_OUT;
+       ata->CurrentTaskFile[0] = protocol; // Protocol
+       ata->CurrentTaskFile[1] = uint8_t(bufferlen / 512); // Payload in 
number of 512 blocks
+       ata->CurrentTaskFile[3] = (comID & 0x00ff); // Commid LSB
+       ata->CurrentTaskFile[4] = ((comID & 0xff00) >> 8); // Commid MSB
+       
     ata->DataBuffer = buffer;
     ata->DataTransferLength = bufferlen;
-    ata->TimeOutValue = 300;
+    ata->TimeOutValue = 1;
     /* these were a b**** to find  defined in TCG specs but location is defined
      * in ATA spec */
-    if (IDENTIFY != cmd) {
-        ata->CurrentTaskFile[0] = protocol; // Protocol
-        ata->CurrentTaskFile[1] = uint8_t(bufferlen / 512); // Payload in 
number of 512 blocks
-        // Damn self inflicted endian bugs
-        // The comID is passed in host endian format in the taskfile
-        // don't know why?? Translated later?
         ata->CurrentTaskFile[3] = (comID & 0x00ff); // Commid LSB
         ata->CurrentTaskFile[4] = ((comID & 0xff00) >> 8); // Commid MSB
-    }
     ata->CurrentTaskFile[6] = (uint8_t) cmd; // ata Command
     //LOG(D4) << "ata before";
     //IFLOG(D4) hexDump(ata, sizeof (ATA_PASS_THROUGH_DIRECT));
-    DeviceIoControl(hDev, // device to be queried
+    BOOL iorc = DeviceIoControl(hDev, // device to be queried
                     IOCTL_ATA_PASS_THROUGH_DIRECT, // operation to perform
                     ata, sizeof (ATA_PASS_THROUGH_DIRECT),
                     ata, sizeof (ATA_PASS_THROUGH_DIRECT),
                     &bytesReturned, // # bytes returned
                     (LPOVERLAPPED) NULL); // synchronous I/O
-    //LOG(D4) << "ata after";
-    //IFLOG(D4) hexDump(ata, sizeof (ATA_PASS_THROUGH_DIRECT));
-    return (ata->CurrentTaskFile[0]);
+       DWORD lasterror = GetLastError();
+       LOG(D1) << "iorc = " << iorc << " GetLastError = " << lasterror << " 
taskfile[0] = " << ata->CurrentTaskFile[0];
+       if (0 != lasterror) return 1;
+       return 0;
+    
 }
 
 /** adds the IDENTIFY information to the disk_info structure */
@@ -113,7 +113,7 @@
        identifyResp = _aligned_malloc(MIN_BUFFER_LENGTH, IO_BUFFER_ALIGNMENT);
     if (NULL == identifyResp) return;
     memset(identifyResp, 0, MIN_BUFFER_LENGTH);
-    uint8_t iorc = sendCmd(IDENTIFY, 0x00, 0x0000, identifyResp, 
MIN_BUFFER_LENGTH);
+    uint8_t iorc = sendCmd(IDENTIFY, 0x00, 0x0000, identifyResp, 512);
     // TODO: figure out why iorc = 4
     if ((0x00 != iorc) && (0x04 != iorc)) {
         LOG(D) << "IDENTIFY Failed " << (uint16_t) iorc;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/windows/DtaDiskNVMe.cpp 
new/sedutil-1.20.0/windows/DtaDiskNVMe.cpp
--- old/sedutil-1.15.1/windows/DtaDiskNVMe.cpp  2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/windows/DtaDiskNVMe.cpp  2021-08-18 14:18:03.000000000 
+0200
@@ -17,7 +17,7 @@
 along with sedutil.  If not, see <http://www.gnu.org/licenses/>.
 
 * C:E********************************************************************** */
-#pragma once
+
 #include "os.h"
 #include <stdio.h>
 #include <iostream>
@@ -25,7 +25,6 @@
 #pragma warning(disable : 4091)
 #include <Ntddscsi.h>
 #pragma warning(pop)
-#include <winioctl.h>
 #include <vector>
 #include "DtaDiskNVMe.h"
 #include "DtaEndianFixup.h"
@@ -33,159 +32,135 @@
 #include "DtaHexDump.h"
 
 using namespace std;
-
-// Missing stuff pulled from MSDN
-//
-
-// STORAGE PROPERTY ID is defined but these #define values are missing
-#define StorageAdapterProtocolSpecificProperty (STORAGE_PROPERTY_ID) 49
-
-#define NVME_MAX_LOG_SIZE 4096  // value from random internet search
-typedef enum _STORAGE_PROTOCOL_TYPE {
-       ProtocolTypeUnknown = 0x00,
-       ProtocolTypeScsi,
-       ProtocolTypeAta,
-       ProtocolTypeNvme,
-       ProtocolTypeSd,
-       ProtocolTypeProprietary = 0x7E,
-       ProtocolTypeMaxReserved = 0x7F
-} STORAGE_PROTOCOL_TYPE, *PSTORAGE_PROTOCOL_TYPE;
-typedef struct _STORAGE_PROTOCOL_SPECIFIC_DATA {
-       STORAGE_PROTOCOL_TYPE ProtocolType;
-       DWORD                 DataType;
-       DWORD                 ProtocolDataRequestValue;
-       DWORD                 ProtocolDataRequestSubValue;
-       DWORD                 ProtocolDataOffset;
-       DWORD                 ProtocolDataLength;
-       DWORD                 FixedProtocolReturnData;
-       DWORD                 Reserved[3];
-} STORAGE_PROTOCOL_SPECIFIC_DATA, *PSTORAGE_PROTOCOL_SPECIFIC_DATA;
-
-typedef enum _STORAGE_PROTOCOL_NVME_DATA_TYPE {
-       NVMeDataTypeUnknown = 0,
-       NVMeDataTypeIdentify,
-       NVMeDataTypeLogPage,
-       NVMeDataTypeFeature
-} STORAGE_PROTOCOL_NVME_DATA_TYPE, *PSTORAGE_PROTOCOL_NVME_DATA_TYPE;
-typedef struct _STORAGE_PROTOCOL_DATA_DESCRIPTOR {
-       DWORD                          Version;
-       DWORD                          Size;
-       STORAGE_PROTOCOL_SPECIFIC_DATA ProtocolSpecificData;
-} STORAGE_PROTOCOL_DATA_DESCRIPTOR, *PSTORAGE_PROTOCOL_DATA_DESCRIPTOR;
-
-// End of missing stuff
-
-
-
 DtaDiskNVMe::DtaDiskNVMe() {};
 void DtaDiskNVMe::init(const char * devref)
 {
     LOG(D1) << "Creating DtaDiskNVMe::DtaDiskNVMe() " << devref;
-
+    
      hDev = CreateFile(devref,
-                      GENERIC_WRITE | GENERIC_READ,
-                      FILE_SHARE_WRITE | FILE_SHARE_READ,
+                      GENERIC_WRITE | GENERIC_READ | GENERIC_EXECUTE,
+                      FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
                       NULL,
                       OPEN_EXISTING,
                       0,
                       NULL);
-    if (INVALID_HANDLE_VALUE == hDev) 
-               return;
+        if (INVALID_HANDLE_VALUE == hDev) {
+                LOG(E) << "Unable to open the device " << devref;
+                return;
+        }
     else 
         isOpen = TRUE;
 }
-
 uint8_t DtaDiskNVMe::sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID,
-                        void * buffer, uint16_t bufferlen)
+       void * buffer, uint32_t bufferlen)
 {
-       UNREFERENCED_PARAMETER(cmd);
-       UNREFERENCED_PARAMETER(protocol);
-       UNREFERENCED_PARAMETER(comID);
-       UNREFERENCED_PARAMETER(buffer);
-       UNREFERENCED_PARAMETER(bufferlen);
        LOG(D1) << "Entering DtaDiskNVMe::sendCmd";
-       LOG(D1) << "DtaDiskNVMe::sendCmd Not yet implemented ";
-       return DTAERROR_COMMAND_ERROR;
+       DWORD bytesReturned = 0; // data returned
+       if (!isOpen) {
+               LOG(E) << "Device open failed";
+               return DTAERROR_OPEN_ERR; //disk open failed so this will too
+       }
+       SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER sptdwb;
+
+       memset(&sptdwb, 0, sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER));
+       sptdwb.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
+       sptdwb.sptd.PathId = 0;
+       sptdwb.sptd.TargetId = 1;
+       sptdwb.sptd.Lun = 0;
+       sptdwb.sptd.SenseInfoLength = 32;
+       
+       sptdwb.sptd.DataTransferLength = bufferlen;
+       sptdwb.sptd.TimeOutValue = 2;
+       sptdwb.sptd.DataBuffer = buffer;
+       sptdwb.sptd.SenseInfoOffset =
+               offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
+       switch (cmd) {
+       case IF_RECV:
+       /* Security Protocol IN */
+               sptdwb.sptd.Cdb[0] = 0xa2;
+               sptdwb.sptd.Cdb[1] = protocol;
+               sptdwb.sptd.Cdb[2] = ((comID & 0xff00) >> 8);
+               sptdwb.sptd.Cdb[3] = (comID & 0x00ff);
+               sptdwb.sptd.Cdb[6] = (UCHAR)((bufferlen & 0xff000000) >> 24);
+               sptdwb.sptd.Cdb[7] = (UCHAR)((bufferlen & 0x00ff0000) >> 16);
+               sptdwb.sptd.Cdb[8] = (UCHAR)((bufferlen & 0x0000ff00) >> 8);
+               sptdwb.sptd.Cdb[9] = (UCHAR)((bufferlen & 0x000000ff));
+               sptdwb.sptd.CdbLength = 12;
+               sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_IN;
+               break;
+       case IF_SEND:
+               /* Security Protocol OUT */
+               sptdwb.sptd.Cdb[0] = 0xb5;
+               sptdwb.sptd.Cdb[1] = protocol;
+               sptdwb.sptd.Cdb[2] = ((comID & 0xff00) >> 8);
+               sptdwb.sptd.Cdb[3] = (comID & 0x00ff);
+               sptdwb.sptd.Cdb[6] = (UCHAR)((bufferlen & 0xff000000) >> 24);
+               sptdwb.sptd.Cdb[7] = (UCHAR)((bufferlen & 0x00ff0000) >> 16);
+               sptdwb.sptd.Cdb[8] = (UCHAR)((bufferlen & 0x0000ff00) >> 8);
+               sptdwb.sptd.Cdb[9] = (UCHAR)((bufferlen & 0x000000ff));
+               sptdwb.sptd.CdbLength = 12;
+               sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_OUT;
+               break;
+       case IDENTIFY:
+               sptdwb.sptd.Cdb[0] = 0x12;
+               sptdwb.sptd.Cdb[4] = 0x60;
+               sptdwb.sptd.CdbLength = 6;
+               sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_IN;
+               break;
+       default:
+               LOG(E) << "Invalid IO Command";
+               return 1;
+       }
+       
+       BOOL iorc = DeviceIoControl(hDev,
+               IOCTL_SCSI_PASS_THROUGH_DIRECT,
+               &sptdwb,
+               sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
+               &sptdwb,
+               sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
+               &bytesReturned,
+               FALSE);
+
+       DWORD lasterror = GetLastError();
+       if ((sptdwb.sptd.ScsiStatus == 0) && (iorc != 0)) {
+               return 0;
+       }
+       LOG(D1) << "Error: GetLastError() = " << lasterror << " ScsiStatus = " 
<< (uint16_t)sptdwb.sptd.ScsiStatus << " iorc = " << iorc;
+       return 1;
 }
 
 /** adds the IDENTIFY information to the disk_info structure */
 
 void DtaDiskNVMe::identify(OPAL_DiskInfo& disk_info)
 {
-    LOG(D1) << "Entering DtaDiskNVMe::identify()";
-       PVOID   buffer = NULL;
-       UINT8   *results = NULL;
-       ULONG   bufferLength = 0;
-       DWORD dwReturned = 0;
-       BOOL iorc = 0;
-
-       PSTORAGE_PROPERTY_QUERY query = NULL;
-       PSTORAGE_PROTOCOL_SPECIFIC_DATA protocolData = NULL;
-       PSTORAGE_PROTOCOL_DATA_DESCRIPTOR protocolDataDescr = NULL;
-       //  This buffer allocation is needed because the STORAGE_PROPERTY_QUERY 
has additional data
-       // that the nvme driver doesn't use ???????????????????
-       /* 
****************************************************************************************
-       !!DANGER WILL ROBINSON!! !!DANGER WILL ROBINSON!! !!DANGER WILL 
ROBINSON!!
-       This buffer definition causes the STORAGE_PROTOCOL_SPECIFIC_DATA to 
OVERLAY the
-       STORAGE_PROPERTY_QUERY.AdditionalParameters field
-       * 
****************************************************************************************
 */
-       bufferLength = FIELD_OFFSET(STORAGE_PROPERTY_QUERY, 
AdditionalParameters)
-               + sizeof(STORAGE_PROTOCOL_SPECIFIC_DATA) + NVME_MAX_LOG_SIZE;
-       buffer = malloc(bufferLength);
-       /* */
-       if (buffer == NULL) {
-               LOG(E) << "DeviceNVMeQueryProtocolDataTest: allocate buffer 
failed, exit.\n";
+       LOG(D1) << "Entering DtaDiskNVMe::identify()";
+       vector<uint8_t> nullz(512, 0x00);
+    void * identifyResp = NULL;
+       identifyResp = _aligned_malloc(MIN_BUFFER_LENGTH, IO_BUFFER_ALIGNMENT);
+    if (NULL == identifyResp) return;
+    memset(identifyResp, 0, MIN_BUFFER_LENGTH);
+    uint8_t iorc = sendCmd(IDENTIFY, 0x00, 0x0000, identifyResp, 
MIN_BUFFER_LENGTH);
+    // TODO: figure out why iorc = 4
+    if ((0x00 != iorc) && (0x04 != iorc)) {
+               printf("%s %d \n", "IDENTIFY Failed ", (uint16_t) iorc);
+       _aligned_free(identifyResp);
+        return;
+    }
+       if (!(memcmp(identifyResp, nullz.data(), 512))) {
+               disk_info.devType = DEVICE_TYPE_OTHER;
                return;
        }
-
-       //
-       // Initialize query data structure to get Identify Data.
-       //
-       ZeroMemory(buffer, bufferLength);
-
-       query = (PSTORAGE_PROPERTY_QUERY)buffer;
-       /* 
****************************************************************************************
-       !!DANGER WILL ROBINSON!! !!DANGER WILL ROBINSON!! !!DANGER WILL 
ROBINSON!!
-       This buffer definition causes the STORAGE_PROTOCOL_SPECIFIC_DATA to 
OVERLAY the
-       STORAGE_PROPERTY_QUERY.AdditionalParameters field
-       * 
****************************************************************************************
 */
-       protocolDataDescr = (PSTORAGE_PROTOCOL_DATA_DESCRIPTOR)buffer;
-       protocolData = 
(PSTORAGE_PROTOCOL_SPECIFIC_DATA)query->AdditionalParameters;
-       /* */
-       query->PropertyId = StorageAdapterProtocolSpecificProperty;
-       query->QueryType = PropertyStandardQuery;
-
-       protocolData->ProtocolType = ProtocolTypeNvme;
-       protocolData->DataType = NVMeDataTypeIdentify;
-       //      protocolData->ProtocolDataRequestValue = 
NVME_IDENTIFY_CNS_CONTROLLER;
-       protocolData->ProtocolDataRequestSubValue = 0;
-       protocolData->ProtocolDataOffset = 
sizeof(STORAGE_PROTOCOL_SPECIFIC_DATA);
-       protocolData->ProtocolDataLength = NVME_MAX_LOG_SIZE;
-
-       iorc = DeviceIoControl(hDev, IOCTL_STORAGE_QUERY_PROPERTY,
-               buffer, bufferLength, buffer, bufferLength, &dwReturned, NULL);
-
-//
-//
-//
-    disk_info.devType = DEVICE_TYPE_NVME;
-       results = (UINT8 *)buffer + FIELD_OFFSET(STORAGE_PROPERTY_QUERY, 
AdditionalParameters)
-               + sizeof(STORAGE_PROTOCOL_SPECIFIC_DATA);
-       results += 4;
-       memcpy(disk_info.serialNum, results, sizeof(disk_info.serialNum));
-       results += sizeof(disk_info.serialNum);
-       memcpy(disk_info.modelNum, results, sizeof(disk_info.modelNum));
-       results += sizeof(disk_info.modelNum);
-       memcpy(disk_info.firmwareRev, results, sizeof(disk_info.firmwareRev));
-       
-
-    return;
+       SCSI_INQUIRY_RESPONSE * id = (SCSI_INQUIRY_RESPONSE *)identifyResp;
+       //memcpy(disk_info.serialNum, id->ProductSerial, 
sizeof(disk_info.serialNum));
+       memcpy(disk_info.firmwareRev, id->ProductRev, sizeof(id->ProductRev));
+       memcpy(disk_info.modelNum, id->ProductID, sizeof(id->ProductID));
+       _aligned_free(identifyResp);
+       return;
 }
 
 /** Close the filehandle so this object can be delete. */
 DtaDiskNVMe::~DtaDiskNVMe()
 {
-    LOG(D1) << "Destroying DtaDiskNVMe";
+       LOG(D1) << "Destroying DtaDiskNVMe";
     CloseHandle(hDev);
-
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/windows/DtaDiskNVMe.h 
new/sedutil-1.20.0/windows/DtaDiskNVMe.h
--- old/sedutil-1.15.1/windows/DtaDiskNVMe.h    2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/windows/DtaDiskNVMe.h    2021-08-18 14:18:03.000000000 
+0200
@@ -19,8 +19,21 @@
 * C:E********************************************************************** */
 #pragma once
 #include "os.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "DtaHexDump.h"
+
+#pragma warning(push)
+#pragma warning(disable : 4091)
+#include <Ntddscsi.h>
+#pragma warning(pop)
 #include "DtaDiskType.h"
 /** Device specific implementation of disk access functions. */
+typedef struct _SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER {
+       SCSI_PASS_THROUGH_DIRECT sptd;
+       ULONG             Filler;      // realign buffer to double word boundary
+       UCHAR             ucSenseBuf[32];
+} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
 
 class DtaDiskNVMe : public DtaDiskType {
 public:
@@ -43,7 +56,7 @@
        * @param bufferlen length of the input/output buffer
        */
        uint8_t sendCmd(ATACOMMAND cmd, uint8_t protocol, uint16_t comID,
-               void * buffer, uint16_t bufferlen);
+               void * buffer, uint32_t bufferlen);
        /** OS specific routine to send an ATA identify to the device */
        void identify(OPAL_DiskInfo& disk_info);
 private:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/windows/DtaDiskUSB.cpp 
new/sedutil-1.20.0/windows/DtaDiskUSB.cpp
--- old/sedutil-1.15.1/windows/DtaDiskUSB.cpp   2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/windows/DtaDiskUSB.cpp   2021-08-18 14:18:03.000000000 
+0200
@@ -142,7 +142,7 @@
                _aligned_free(identifyResp);
                return;
        }
-       USB_INQUIRY_DATA * id = (USB_INQUIRY_DATA *) identifyResp;
+       UASP_INQUIRY_RESPONSE * id = (UASP_INQUIRY_RESPONSE *) identifyResp;
     disk_info.devType = DEVICE_TYPE_USB;
     for (int i = 0; i < sizeof (disk_info.serialNum); i += 2) {
         disk_info.serialNum[i] = id->ProductSerial[i + 1];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sedutil-1.15.1/windows/DtaDiskUSB.h 
new/sedutil-1.20.0/windows/DtaDiskUSB.h
--- old/sedutil-1.15.1/windows/DtaDiskUSB.h     2017-08-22 02:28:11.000000000 
+0200
+++ new/sedutil-1.20.0/windows/DtaDiskUSB.h     2021-08-18 14:18:03.000000000 
+0200
@@ -28,13 +28,6 @@
 
 } SDWB;
 
-typedef struct _USB_INQUIRY_DATA {
-       uint8_t fill1[20];
-       char ProductSerial[20];
-       uint8_t fill2[6];
-       char ProductRev[8];
-       char ProductID[40];
-} USB_INQUIRY_DATA;
 
 class DtaDiskUSB : public DtaDiskType {
 public:

Reply via email to