1 // Copyright (C) 2018 Michael McMaster <michael@codesrc.com>
3 // This file is part of SCSI2SD.
5 // SCSI2SD is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // SCSI2SD is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
19 // For compilers that support precompilation, includes "wx/wx.h".
20 #include "SCSI2SD_HID.hh"
30 #if __cplusplus >= 201103L
33 using std::shared_ptr
;
37 using std::tr1::shared_ptr
;
40 using namespace SCSI2SD
;
47 hid
.reset(HID::Open());
50 std::cout
<< "SCSI2SD Ready, firmware version " <<
51 hid
->getFirmwareVersionStr() << "\n";
53 std::vector
<uint8_t> csd(hid
->getSD_CSD());
54 std::vector
<uint8_t> cid(hid
->getSD_CID());
55 std::cout
<< "SD Capacity (512-byte sectors): " <<
56 hid
->getSDCapacity() << std::endl
;
59 std::cout
<< "SCSI Self-Test: ";
60 if (hid
->scsiSelfTest(errcode
))
62 std::cout
<< "Passed\n";
66 std::cout
<< "FAIL (" << errcode
<< ")\n";
71 std::cerr
<< "Device not found" << std::endl
;
74 catch (std::runtime_error
& e
)
76 std::cerr
<< e
.what() << std::endl
;