| 313 | } |
| 314 | |
| 315 | unsigned int ParseMode(DeviceOptions& options, std::vector<RGBController *> &rgb_controllers) |
| 316 | { |
| 317 | // no need to check if --mode wasn't passed |
| 318 | if (options.mode.size() == 0) |
| 319 | { |
| 320 | return rgb_controllers[options.device]->active_mode; |
| 321 | } |
| 322 | |
| 323 | /*---------------------------------------------------------*\ |
| 324 | | Search through all of the device modes and see if there is| |
| 325 | | a match. If no match is found, print an error message. | |
| 326 | \*---------------------------------------------------------*/ |
| 327 | for(unsigned int mode_idx = 0; mode_idx < rgb_controllers[options.device]->modes.size(); mode_idx++) |
| 328 | { |
| 329 | if (strcasecmp(rgb_controllers[options.device]->modes[mode_idx].name.c_str(), options.mode.c_str()) == 0) |
| 330 | { |
| 331 | return mode_idx; |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | std::cout << "Error: Mode '" + options.mode + "' not available for device '" + rgb_controllers[options.device]->name + "'" << std::endl; |
| 336 | return false; |
| 337 | } |
| 338 | |
| 339 | DeviceOptions* GetDeviceOptionsForDevID(Options *opts, int device) |
| 340 | { |