示例#1
0
int main(int argc, char *argv[], char **envp) {
	memset(command,0,MAX_COMMAND);
	if (debug) printf("Debug: Hit main code block. Parsing arguments...\n");
	parse_arguments(argc, argv, envp);
	if (help) { print_help(); return 0; }
	if (debug) {
		if (user_is_root) printf("Debug: Detection suggests user may be root\n");
		else printf("Debug: Detection suggests user may NOT be root\n");
	}
	if (command[0]==0) printf("Warning: no command or preset supplied\n");
	if (AlienfxInit()) {
		if (debug) printf("Debug: Found an AlienFX chip\n");
		if (reboot) afx_reboot();
		if (darkness) afx_reset();
		if (rawmode) {
			afx_raw(rawcmd);
		} else {
			if (command[0]>0) { /*if (usb_is_ready())*/ afx_process(command); }
			else if (!darkness) { if (usb_is_ready()) afx_reset(); }
		}
		AlienfxDeinit();
	} else {
		if (debug) printf("Debug: USB driver could not locate AlienFX chip.  Consult manpage?\n");
		if (debug2) printf("Debug: Use the -P setting to specify the product ID of your AlienFX chip.\n");
		if (debug2) printf("Debug: You may find the product ID by running the 'lsusb' command.\n");
		printf("Error: AlienFX not detected.\n");
		return 1;
	}
	if (debug) printf("Debug: Exiting\n");
	return 0;
} //EOF
示例#2
0
	~WorkCleanup()
	{
		AlienfxDeinit();
	}