/* * (C) Copyright Johannes Brodwall , 2006 * * Version 1.0.1 * * History: * * 2006/02/20: Version 1.0: Colors and brightnesses with range checking. * * 05/11/2006: Tweaked by David Pritchard to add touchpad configuration. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "xps_led_control_lib.h" #include #include #include void usage(char* program_name) { printf("usage: %s [-all color] [-front color] [-top color] " "[-side color] [-bright value] [-touchpad 0|1]\n", program_name); printf(" Where color is a number from 0-16\n"); printf(" and brightness value is a number from 0-7\n"); printf("\n"); printf("(C) Copyright Johannes Brodwall , 2006\n"); printf(" Some rights reserved: http://creativecommons.org/licenses/by/2.5/\n"); } void check_range(char* program_name, char* parameter_name, int value, int low, int high) { if (value < low || high < value) { printf("Invalid value for '%s' (was %d)\n", parameter_name, value); usage(program_name); exit(-2); } else { //printf("%s = %d\n", parameter_name, value); } } int main(int argc, char** argv) { unsigned int side_color = 0; unsigned int front_color = 0; unsigned int top_color = 0; unsigned int brightness = 7; unsigned int touchpad_light = 0; int i = 1; if (argc<2) { usage(argv[0]); exit(0); } for (i=1; i