manager: populate USB vendor/product ID's with default values

We'll need those in the `udev` module, but never made it a mandatory
config option. This commit makes sure those values are properly filled
in.
This commit is contained in:
Arnaud Ferraris
2022-01-04 15:24:01 +01:00
parent 61c89a003a
commit df79247821

View File

@@ -38,6 +38,9 @@
#define EG25_VERSION "0.0.0"
#endif
#define EG25_DEFAULT_VENDOR_ID 0x2c7c
#define EG25_DEFAULT_PRODUCT_ID 0x0125
#define POWERON_DELAY_US 100000UL
static gboolean quit_app(struct EG25Manager *manager)
@@ -369,9 +372,11 @@ int main(int argc, char *argv[])
config_get_bool(manager_config, "monitor_udev", &monitor_udev);
config_get_bool(manager_config, "need_libusb", &manager.use_libusb);
config_get_uint(manager_config, "usb_vid", &manager.usb_vid);
config_get_uint(manager_config, "usb_pid", &manager.usb_pid);
config_get_uint(manager_config, "poweron_delay", &manager.poweron_delay);
if (!config_get_uint(manager_config, "usb_vid", &manager.usb_vid))
manager.usb_vid = EG25_DEFAULT_VENDOR_ID;
if (!config_get_uint(manager_config, "usb_pid", &manager.usb_pid))
manager.usb_pid = EG25_DEFAULT_PRODUCT_ID;
at_init(&manager, toml_config);
gpio_init(&manager, toml_config);