]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - knowndrives.h
Imported Upstream version 5.39.1+svn3124
[mirror_smartmontools-debian.git] / knowndrives.h
CommitLineData
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 *
e9583e0c
GI
7 * Copyright (C) 2003-10 Philip Williams, Bruce Allen
8 * Copyright (C) 2008-10 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
e9583e0c 24#define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 3093 2010-04-30 09:57:36Z chrfranke $\n"
832b75ed 25
a23d5117 26// Structure to store drive database entries, see drivedb.h for a description.
2127e193 27struct 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
GG
34
35// Searches knowndrives[] for a drive with the given model number and firmware
36// string.
2127e193 37const drive_settings * lookup_drive(const char * model, const char * firmware);
832b75ed 38
e9583e0c
GI
39// info returned by lookup_usb_device()
40struct usb_dev_info
41{
42 std::string usb_device; // Device name, empty if unknown
43 std::string usb_bridge; // USB bridge name, empty if unknown
44 std::string usb_type; // Type string ('-d' option).
45};
46
47// Search drivedb for USB device with vendor:product ID.
48int lookup_usb_device(int vendor_id, int product_id, int bcd_device,
49 usb_dev_info & info, usb_dev_info & info2);
50
832b75ed 51// Shows the presets (if any) that are available for the given drive.
2127e193 52void show_presets(const ata_identify_device * drive, bool fix_swapped_id);
832b75ed
GG
53
54// Shows all presets for drives in knowndrives[].
2127e193
GI
55// Returns #syntax errors.
56int showallpresets();
832b75ed
GG
57
58// Shows all matching presets for a drive in knowndrives[].
59// Returns # matching entries.
60int showmatchingpresets(const char *model, const char *firmware);
61
62// Sets preset vendor attribute options in opts by finding the entry
63// (if any) for the given drive in knowndrives[]. Values that have
64// already been set in opts will not be changed. Also sets options in
2127e193 65// con. Returns false if drive not recognized.
bed94269 66bool apply_presets(const ata_identify_device * drive, ata_vendor_attr_defs & defs,
2127e193
GI
67 unsigned char & fix_firmwarebug, bool fix_swapped_id);
68
e9583e0c
GI
69// Get path for additional database file
70const char * get_drivedb_path_add();
71
72#ifdef SMARTMONTOOLS_DRIVEDBDIR
73// Get path for default database file
74const char * get_drivedb_path_default();
75#endif
76
2127e193
GI
77// Read drive database from file.
78bool read_drive_database(const char * path);
79
80// Read drive databases from standard places.
81bool read_default_drive_databases();
832b75ed
GG
82
83#endif