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