]>
Commit | Line | Data |
---|---|---|
832b75ed GG |
1 | /* |
2 | * knowndrives.h | |
3 | * | |
6b80b4d2 | 4 | * Home page of code is: http://www.smartmontools.org |
832b75ed | 5 | * |
cfbba5b9 | 6 | * Copyright (C) 2003-11 Philip Williams, Bruce Allen |
6b80b4d2 | 7 | * Copyright (C) 2008-15 Christian Franke |
832b75ed GG |
8 | * |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License as published by | |
11 | * the Free Software Foundation; either version 2, or (at your option) | |
12 | * any later version. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
ee38a438 | 15 | * (for example COPYING); If not, see <http://www.gnu.org/licenses/>. |
832b75ed GG |
16 | * |
17 | */ | |
18 | ||
19 | #ifndef KNOWNDRIVES_H_ | |
20 | #define KNOWNDRIVES_H_ | |
21 | ||
6b80b4d2 | 22 | #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 4162 2015-10-31 16:36:16Z chrfranke $\n" |
832b75ed | 23 | |
a23d5117 | 24 | // Structure to store drive database entries, see drivedb.h for a description. |
2127e193 | 25 | struct drive_settings { |
4d59bff9 GG |
26 | const char * modelfamily; |
27 | const char * modelregexp; | |
28 | const char * firmwareregexp; | |
29 | const char * warningmsg; | |
2127e193 GI |
30 | const char * presets; |
31 | }; | |
832b75ed | 32 | |
e9583e0c GI |
33 | // info returned by lookup_usb_device() |
34 | struct usb_dev_info | |
35 | { | |
36 | std::string usb_device; // Device name, empty if unknown | |
37 | std::string usb_bridge; // USB bridge name, empty if unknown | |
38 | std::string usb_type; // Type string ('-d' option). | |
39 | }; | |
40 | ||
41 | // Search drivedb for USB device with vendor:product ID. | |
42 | int lookup_usb_device(int vendor_id, int product_id, int bcd_device, | |
43 | usb_dev_info & info, usb_dev_info & info2); | |
44 | ||
832b75ed | 45 | // Shows the presets (if any) that are available for the given drive. |
cfbba5b9 | 46 | void show_presets(const ata_identify_device * drive); |
832b75ed GG |
47 | |
48 | // Shows all presets for drives in knowndrives[]. | |
2127e193 GI |
49 | // Returns #syntax errors. |
50 | int showallpresets(); | |
832b75ed GG |
51 | |
52 | // Shows all matching presets for a drive in knowndrives[]. | |
53 | // Returns # matching entries. | |
54 | int showmatchingpresets(const char *model, const char *firmware); | |
55 | ||
cfbba5b9 | 56 | // Searches drive database and sets preset vendor attribute |
ee38a438 | 57 | // options in defs and firmwarebugs. |
cfbba5b9 GI |
58 | // Values that have already been set will not be changed. |
59 | // Returns pointer to database entry or nullptr if none found. | |
60 | const drive_settings * lookup_drive_apply_presets( | |
61 | const ata_identify_device * drive, ata_vendor_attr_defs & defs, | |
ee38a438 | 62 | firmwarebug_defs & firmwarebugs); |
2127e193 | 63 | |
e9583e0c GI |
64 | // Get path for additional database file |
65 | const char * get_drivedb_path_add(); | |
66 | ||
67 | #ifdef SMARTMONTOOLS_DRIVEDBDIR | |
68 | // Get path for default database file | |
69 | const char * get_drivedb_path_default(); | |
70 | #endif | |
71 | ||
2127e193 GI |
72 | // Read drive database from file. |
73 | bool read_drive_database(const char * path); | |
74 | ||
6b80b4d2 JD |
75 | // Init default db entry and optionally read drive databases from standard places. |
76 | bool init_drive_database(bool use_default_db); | |
77 | ||
78 | // Get vendor attribute options from default db entry. | |
79 | const ata_vendor_attr_defs & get_default_attr_defs(); | |
832b75ed GG |
80 | |
81 | #endif |