]>
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 GI |
7 | * Copyright (C) 2003-11 Philip Williams, Bruce Allen |
8 | * Copyright (C) 2008-11 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 | |
16 | * (for example COPYING); if not, write to the Free | |
17 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
18 | * | |
19 | */ | |
20 | ||
21 | #ifndef KNOWNDRIVES_H_ | |
22 | #define KNOWNDRIVES_H_ | |
23 | ||
cfbba5b9 | 24 | #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 3288 2011-03-09 18:40:36Z chrfranke $\n" |
832b75ed | 25 | |
a23d5117 | 26 | // Structure to store drive database entries, see drivedb.h for a description. |
2127e193 | 27 | struct drive_settings { |
4d59bff9 GG |
28 | const char * modelfamily; |
29 | const char * modelregexp; | |
30 | const char * firmwareregexp; | |
31 | const char * warningmsg; | |
2127e193 GI |
32 | const char * presets; |
33 | }; | |
832b75ed | 34 | |
e9583e0c GI |
35 | // info returned by lookup_usb_device() |
36 | struct usb_dev_info | |
37 | { | |
38 | std::string usb_device; // Device name, empty if unknown | |
39 | std::string usb_bridge; // USB bridge name, empty if unknown | |
40 | std::string usb_type; // Type string ('-d' option). | |
41 | }; | |
42 | ||
43 | // Search drivedb for USB device with vendor:product ID. | |
44 | int lookup_usb_device(int vendor_id, int product_id, int bcd_device, | |
45 | usb_dev_info & info, usb_dev_info & info2); | |
46 | ||
832b75ed | 47 | // Shows the presets (if any) that are available for the given drive. |
cfbba5b9 | 48 | void show_presets(const ata_identify_device * drive); |
832b75ed GG |
49 | |
50 | // Shows all presets for drives in knowndrives[]. | |
2127e193 GI |
51 | // Returns #syntax errors. |
52 | int showallpresets(); | |
832b75ed GG |
53 | |
54 | // Shows all matching presets for a drive in knowndrives[]. | |
55 | // Returns # matching entries. | |
56 | int showmatchingpresets(const char *model, const char *firmware); | |
57 | ||
cfbba5b9 GI |
58 | // Searches drive database and sets preset vendor attribute |
59 | // options in defs and fix_firmwarebug. | |
60 | // Values that have already been set will not be changed. | |
61 | // Returns pointer to database entry or nullptr if none found. | |
62 | const drive_settings * lookup_drive_apply_presets( | |
63 | const ata_identify_device * drive, ata_vendor_attr_defs & defs, | |
64 | unsigned char & fix_firmwarebug); | |
2127e193 | 65 | |
e9583e0c GI |
66 | // Get path for additional database file |
67 | const char * get_drivedb_path_add(); | |
68 | ||
69 | #ifdef SMARTMONTOOLS_DRIVEDBDIR | |
70 | // Get path for default database file | |
71 | const char * get_drivedb_path_default(); | |
72 | #endif | |
73 | ||
2127e193 GI |
74 | // Read drive database from file. |
75 | bool read_drive_database(const char * path); | |
76 | ||
77 | // Read drive databases from standard places. | |
78 | bool read_default_drive_databases(); | |
832b75ed GG |
79 | |
80 | #endif |