1 /**************************************************************************
2  Copyright:
3       (C) 2008 - 2012  Alexander Shaduri <ashaduri 'at' gmail.com>
4  License: See LICENSE_gsmartcontrol.txt
5 ***************************************************************************/
6 /// \file
7 /// \author Alexander Shaduri
8 /// \ingroup gsc
9 /// \weakgroup gsc
10 /// @{
11 
12 #ifndef GSC_SETTINGS_H
13 #define GSC_SETTINGS_H
14 
15 #include "rconfig/rconfig_mini.h"
16 #include "hz/cstdint.h"
17 
18 
19 
20 /// Initializes ALL default settings.
21 /// Absolute paths go to root node, relative ones go to /config and /default.
22 /// Note: There must be no degradation if /config is removed entirely
23 /// during runtime. /default must provide every path which /config could
24 /// have held.
25 /// ALL runtime (that is, non-config-file-writable) settings go to /runtime.
init_default_settings()26 inline void init_default_settings()
27 {
28 	// Populate /default
29 
30 	rconfig::set_default_data("system/config_autosave_timeout", uint32_t(3*60));  // 3 minutes. 0 to disable.
31 	rconfig::set_default_data("system/first_boot", true);  // used to show the first-start warning.
32 
33 
34 #ifndef _WIN32
35 	rconfig::set_default_data("system/smartctl_binary", "smartctl");  // must be in PATH or use absolute path.
36 	rconfig::set_default_data("system/tw_cli_binary", "tw_cli");  // must be in PATH or use absolute path.
37 #else
38 	rconfig::set_default_data("system/smartctl_binary", "smartctl-nc.exe");  // use no-console version by default.
39 	rconfig::set_default_data("system/tw_cli_binary", "tw_cli.exe");
40 	rconfig::set_default_data("system/areca_cli_binary", "cli.exe");  // if relative, an installation path is prepended (if found).
41 #endif
42 	// search for "smartctl-nc.exe" in smartmontools installation first.
43 	rconfig::set_default_data("system/win32_search_smartctl_in_smartmontools", true);
44 	rconfig::set_default_data("system/win32_smartmontools_regpath", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\smartmontools");  // in HKLM
45 	rconfig::set_default_data("system/win32_smartmontools_regpath_wow", "SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\smartmontools");  // in HKLM
46 	rconfig::set_default_data("system/win32_smartmontools_regkey", "InstallLocation");
47 	rconfig::set_default_data("system/win32_smartmontools_smartctl_binary", "bin\\smartctl-nc.exe");  // relative to smt install path
48 	rconfig::set_default_data("system/win32_areca_scan_controllers", int32_t(2));  // 0 - no, 1 - yes, 2 - auto (if areca tools are found)
49 	rconfig::set_default_data("system/win32_areca_use_cli", int32_t(2));  // 0 - no, 1 - yes, 2 - auto (if it's found)
50 	rconfig::set_default_data("system/win32_areca_max_controllers", int32_t(4));  // Maximum number of areca controllers (a safety measure). CLI supports 4.
51 	rconfig::set_default_data("system/win32_areca_enc_max_scan_port", int32_t(36));  // 1-128 (areca with enclosures). The last RAID port to scan if no other method is available
52 	rconfig::set_default_data("system/win32_areca_enc_max_enclosure", int32_t(3));  // 1-8 (areca with enclosures). The last RAID enclosure to scan if no other method is available
53 	rconfig::set_default_data("system/win32_areca_neonc_max_scan_port", int32_t(24));  // 1-24 (areca without enclosures). The last RAID port to scan if no other method is available
54 
55 	rconfig::set_default_data("system/smartctl_options", "");  // default options on ALL commands
56 	rconfig::set_default_data("system/smartctl_device_options", "");  // dev1:val1;dev2:val2;... format, each bin2ascii-encoded.
57 
58 	rconfig::set_default_data("system/linux_udev_byid_path", "/dev/disk/by-id");  // linux hard disk device links here
59 	rconfig::set_default_data("system/linux_proc_partitions_path", "/proc/partitions");  // file in linux /proc/partitions format
60 	rconfig::set_default_data("system/linux_proc_devices_path", "/proc/devices");  // file in linux /proc/devices format
61 	rconfig::set_default_data("system/linux_proc_scsi_scsi_path", "/proc/scsi/scsi");  // file in linux /proc/scsi/scsi format
62 	rconfig::set_default_data("system/linux_proc_scsi_sg_devices_path", "/proc/scsi/sg/devices");  // file in linux /proc/scsi/sg/devices format
63 	rconfig::set_default_data("system/linux_3ware_max_scan_port", int32_t(23));  // 0-127 (3ware). The last RAID port to scan if no other method is available
64 	rconfig::set_default_data("system/linux_areca_enc_max_scan_port", int32_t(36));  // 1-128 (areca with enclosures). The last RAID port to scan if no other method is available
65 	rconfig::set_default_data("system/linux_areca_enc_max_enclosure", int32_t(4));  // 1-8 (areca with enclosures). The last RAID enclosure to scan if no other method is available
66 	rconfig::set_default_data("system/linux_areca_neonc_max_scan_port", int32_t(24));  // 1-24 (areca without enclosures). The last RAID port to scan if no other method is available
67 	rconfig::set_default_data("system/solaris_dev_path", "/dev/rdsk");  // path to /dev/rdsk for solaris.
68 	rconfig::set_default_data("system/unix_sdev_path", "/dev");  // path to /dev. used by other unices
69 // 	rconfig::set_default_data("system/device_match_patterns", "");  // semicolon-separated PCRE patterns
70 	rconfig::set_default_data("system/device_blacklist_patterns", "");  // semicolon-separated PCRE patterns
71 
72 	rconfig::set_default_data("gui/show_smart_capable_only", false);  // show smart-capable drives only
73 	rconfig::set_default_data("gui/scan_on_startup", true);  // scan drives on startup
74 
75 	rconfig::set_default_data("gui/smartctl_output_filename_format", "{model}_{serial}_{date}.txt");  // when suggesting filename
76 
77 	rconfig::set_default_data("gui/icons_show_device_name", false);  // text under icons
78 	rconfig::set_default_data("gui/icons_show_serial_number", false);  // text under icons
79 
80 
81 	// Populate /runtime too, just in case. The values don't really matter.
82 
83 	rconfig::set_data("/runtime/gui/hide_tabs_on_smart_disabled", true);
84 	rconfig::set_data("/runtime/gui/force_no_scan_on_startup", false);
85 	// rconfig::set_data("/runtime/gui/add_virtuals_on_startup", "");  // vector<string>
86 	// rconfig::set_data("/runtime/gui/add_devices_on_startup", "");  // vector<string>
87 
88 }
89 
90 
91 
92 
93 
94 
95 
96 
97 #endif
98 
99 /// @}
100