]>
git.proxmox.com Git - mirror_smartmontools-debian.git/blob - knowndrives.h
4 * Home page of code is: http://www.smartmontools.org
6 * Copyright (C) 2003-11 Philip Williams, Bruce Allen
7 * Copyright (C) 2008-15 Christian Franke
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef KNOWNDRIVES_H_
13 #define KNOWNDRIVES_H_
15 #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 4760 2018-08-19 18:45:53Z chrfranke $\n"
17 // Structure to store drive database entries, see drivedb.h for a description.
18 struct drive_settings
{
19 const char * modelfamily
;
20 const char * modelregexp
;
21 const char * firmwareregexp
;
22 const char * warningmsg
;
26 // info returned by lookup_usb_device()
29 std::string usb_device
; // Device name, empty if unknown
30 std::string usb_bridge
; // USB bridge name, empty if unknown
31 std::string usb_type
; // Type string ('-d' option).
34 // Search drivedb for USB device with vendor:product ID.
35 int lookup_usb_device(int vendor_id
, int product_id
, int bcd_device
,
36 usb_dev_info
& info
, usb_dev_info
& info2
);
38 // Shows the presets (if any) that are available for the given drive.
39 void show_presets(const ata_identify_device
* drive
);
41 // Shows all presets for drives in knowndrives[].
42 // Returns #syntax errors.
45 // Shows all matching presets for a drive in knowndrives[].
46 // Returns # matching entries.
47 int showmatchingpresets(const char *model
, const char *firmware
);
49 // Searches drive database and sets preset vendor attribute
50 // options in defs and firmwarebugs.
51 // Values that have already been set will not be changed.
52 // Returns pointer to database entry or nullptr if none found.
53 const drive_settings
* lookup_drive_apply_presets(
54 const ata_identify_device
* drive
, ata_vendor_attr_defs
& defs
,
55 firmwarebug_defs
& firmwarebugs
);
57 // Get path for additional database file
58 const char * get_drivedb_path_add();
60 #ifdef SMARTMONTOOLS_DRIVEDBDIR
61 // Get path for default database file
62 const char * get_drivedb_path_default();
65 // Read drive database from file.
66 bool read_drive_database(const char * path
);
68 // Init default db entry and optionally read drive databases from standard places.
69 bool init_drive_database(bool use_default_db
);
71 // Get vendor attribute options from default db entry.
72 const ata_vendor_attr_defs
& get_default_attr_defs();