smartmontools SVN Rev 5611
Utility to control and monitor storage systems with "S.M.A.R.T."
knowndrives.h
Go to the documentation of this file.
1/*
2 * knowndrives.h
3 *
4 * Home page of code is: https://www.smartmontools.org
5 *
6 * Copyright (C) 2003-11 Philip Williams, Bruce Allen
7 * Copyright (C) 2008-21 Christian Franke
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12#ifndef KNOWNDRIVES_H_
13#define KNOWNDRIVES_H_
14
15#define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 5207 2021-02-09 20:25:13Z chrfranke $\n"
16
17// Structure to store drive database entries, see drivedb.h for a description.
19 const char * modelfamily;
20 const char * modelregexp;
21 const char * firmwareregexp;
22 const char * warningmsg;
23 const char * presets;
24};
25
26// info returned by lookup_usb_device()
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.
35int lookup_usb_device(int vendor_id, int product_id, int bcd_device,
36 usb_dev_info & info, usb_dev_info & info2);
37
38// Shows the presets (if any) that are available for the given drive.
39void show_presets(const ata_identify_device * drive);
40
41// Shows all presets for drives in knowndrives[].
42// Returns #syntax errors.
43int showallpresets();
44
45// Shows all matching presets for a drive in knowndrives[].
46// Returns # matching entries.
47int showmatchingpresets(const char *model, const char *firmware);
48
49// Searches drive database and sets preset vendor attribute
50// options in defs and firmwarebugs.
51// Values that have already been set will not be changed.
52// Returns pointer to database entry or nullptr if none found.
54 const ata_identify_device * drive, ata_vendor_attr_defs & defs,
55 firmwarebug_defs & firmwarebugs, std::string & dbversion);
56
57// Get path for additional database file
58const char * get_drivedb_path_add();
59
60#ifdef SMARTMONTOOLS_DRIVEDBDIR
61// Get path for default database file
62const char * get_drivedb_path_default();
63#endif
64
65// Read drive database from file.
66bool read_drive_database(const char * path);
67
68// Init default db entry and optionally read drive databases from standard places.
69bool init_drive_database(bool use_default_db);
70
71// Get vendor attribute options from default db entry.
73
74#endif
const drive_settings * lookup_drive_apply_presets(const ata_identify_device *drive, ata_vendor_attr_defs &defs, firmwarebug_defs &firmwarebugs, std::string &dbversion)
bool init_drive_database(bool use_default_db)
const char * get_drivedb_path_add()
void show_presets(const ata_identify_device *drive)
bool read_drive_database(const char *path)
int lookup_usb_device(int vendor_id, int product_id, int bcd_device, usb_dev_info &info, usb_dev_info &info2)
const ata_vendor_attr_defs & get_default_attr_defs()
int showmatchingpresets(const char *model, const char *firmware)
int showallpresets()
const char * modelregexp
Definition: knowndrives.h:20
const char * presets
Definition: knowndrives.h:23
const char * modelfamily
Definition: knowndrives.h:19
const char * warningmsg
Definition: knowndrives.h:22
const char * firmwareregexp
Definition: knowndrives.h:21
std::string usb_device
Definition: knowndrives.h:29
std::string usb_type
Definition: knowndrives.h:31
std::string usb_bridge
Definition: knowndrives.h:30