]>
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 | 8 | * |
ff28b140 | 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
832b75ed GG |
10 | */ |
11 | ||
12 | #ifndef KNOWNDRIVES_H_ | |
13 | #define KNOWNDRIVES_H_ | |
14 | ||
ff28b140 | 15 | #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 4760 2018-08-19 18:45:53Z chrfranke $\n" |
832b75ed | 16 | |
a23d5117 | 17 | // Structure to store drive database entries, see drivedb.h for a description. |
2127e193 | 18 | struct drive_settings { |
4d59bff9 GG |
19 | const char * modelfamily; |
20 | const char * modelregexp; | |
21 | const char * firmwareregexp; | |
22 | const char * warningmsg; | |
2127e193 GI |
23 | const char * presets; |
24 | }; | |
832b75ed | 25 | |
e9583e0c GI |
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 | ||
832b75ed | 38 | // Shows the presets (if any) that are available for the given drive. |
cfbba5b9 | 39 | void show_presets(const ata_identify_device * drive); |
832b75ed GG |
40 | |
41 | // Shows all presets for drives in knowndrives[]. | |
2127e193 GI |
42 | // Returns #syntax errors. |
43 | int showallpresets(); | |
832b75ed GG |
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 | ||
cfbba5b9 | 49 | // Searches drive database and sets preset vendor attribute |
ee38a438 | 50 | // options in defs and firmwarebugs. |
cfbba5b9 GI |
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, | |
ee38a438 | 55 | firmwarebug_defs & firmwarebugs); |
2127e193 | 56 | |
e9583e0c GI |
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 | ||
2127e193 GI |
65 | // Read drive database from file. |
66 | bool read_drive_database(const char * path); | |
67 | ||
6b80b4d2 JD |
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(); | |
832b75ed GG |
73 | |
74 | #endif |