]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - knowndrives.h
import smartmontools 7.0
[mirror_smartmontools-debian.git] / knowndrives.h
1 /*
2 * knowndrives.h
3 *
4 * Home page of code is: http://www.smartmontools.org
5 *
6 * Copyright (C) 2003-11 Philip Williams, Bruce Allen
7 * Copyright (C) 2008-15 Christian Franke
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12 #ifndef KNOWNDRIVES_H_
13 #define KNOWNDRIVES_H_
14
15 #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 4760 2018-08-19 18:45:53Z chrfranke $\n"
16
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;
23 const char * presets;
24 };
25
26 // info returned by lookup_usb_device()
27 struct usb_dev_info
28 {
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).
32 };
33
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);
37
38 // Shows the presets (if any) that are available for the given drive.
39 void show_presets(const ata_identify_device * drive);
40
41 // Shows all presets for drives in knowndrives[].
42 // Returns #syntax errors.
43 int showallpresets();
44
45 // Shows all matching presets for a drive in knowndrives[].
46 // Returns # matching entries.
47 int showmatchingpresets(const char *model, const char *firmware);
48
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);
56
57 // Get path for additional database file
58 const char * get_drivedb_path_add();
59
60 #ifdef SMARTMONTOOLS_DRIVEDBDIR
61 // Get path for default database file
62 const char * get_drivedb_path_default();
63 #endif
64
65 // Read drive database from file.
66 bool read_drive_database(const char * path);
67
68 // Init default db entry and optionally read drive databases from standard places.
69 bool init_drive_database(bool use_default_db);
70
71 // Get vendor attribute options from default db entry.
72 const ata_vendor_attr_defs & get_default_attr_defs();
73
74 #endif