コード例 #1
0
void daemon_close(struct razer_daemon *daemon)
{
	#ifdef USE_DBUS
		daemon_dbus_close(daemon);
	#endif
	list_Close(daemon->libs);
	list_Close(daemon->fx_render_nodes);
	list_Close(daemon->render_nodes);
	list_Close(daemon->effects);
 	razer_close(daemon->chroma);
 	free(daemon);
}
コード例 #2
0
ファイル: first_test.c プロジェクト: circuz/RazerConfig
int main(int argc,char *argv[])
{
	uid_t uid = getuid();
	if(uid != 0)
		printf("This program needs root to work correctly.\n");	
	struct razer_chroma *chroma = razer_open();
	if(!chroma)
		exit(1);
 	razer_set_input_handler(chroma,input_handler);
 	razer_set_custom_mode(chroma);
	razer_clear_all(chroma->keys);
	razer_update_keys(chroma,chroma->keys);
	for(int i=0;i<10;i++)
		keys_history[i] = -1;
 	signal(SIGINT,stop);
 	signal(SIGKILL,stop);
 	signal(SIGTERM,stop);	
	effect(chroma);
 	razer_close(chroma);
}
コード例 #3
0
int main(int argc,char *argv[])
{
	uid_t uid = getuid();
	if(uid != 0)
		printf("input example needs root to work correctly.\n");	
	struct razer_chroma *chroma = razer_open(NULL,NULL);
  
  if(!chroma)
		exit(1);
  system("stty -echo");
 	razer_set_event_handler(chroma,event_handler);
 	razer_set_custom_mode(chroma);
	razer_clear_all(chroma->active_device->leds);
	razer_update_leds(chroma,chroma->active_device->leds);
	for(int i=0;i<10;i++)
		keys_history[i] = -1;
 	signal(SIGINT,stop);
 	signal(SIGKILL,stop);
 	signal(SIGTERM,stop);	
	effect(chroma);
 	razer_close(chroma);
  system("stty echo");
}
コード例 #4
0
int main(int argc,char *argv[])
{


    struct razer_chroma *kbd=razer_open(NULL,NULL);
    if(!kbd) {
        printf("failed to initialize!!!\n");
        exit(0);
    }
    razer_set_custom_mode(kbd);
    razer_clear_all(kbd->active_device->leds);
    razer_update_leds(kbd, kbd->active_device->leds);

    struct razer_rgb color;
    struct razer_pos pos;

    while(1) {
        int cmd;
        scanf("%u", &cmd);
        if(cmd == 1) {
            int x = 0, y = 0;
            int ir, ig, ib;

            printf("Enter x y r g b: ");
            scanf("%u %u %u %u %u", &x, &y, &ir, &ig, &ib);
            printf("Setting key at [%u,%u] to #%x%x%x...", x, y, ir, ig, ib);
            color.r = ir;
            color.g = ig;
            color.b = ib;
            pos.x = x;
            pos.y = y;
            razer_set_led_pos(kbd->active_device->leds, &pos, &color);
            razer_update_leds(kbd, kbd->active_device->leds);
            printf("Done!\n");
        }
        if(cmd == 2) {
            char targs[] = ""; //dziala, char targs[255]
            int ir, ig, ib;

            printf("Enter r g b: ");
            scanf("%u %u %u", &ir, &ig, &ib);
            printf("Enter str: ");
            scanf("%s", targs);
            printf("Setting keys of [%s] to %u %u %u...\n", targs, ir, ig, ib);
            color.r = ir;
            color.g = ig;
            color.b = ib;

            for(unsigned int i = 0; i < strlen(targs); i++) {
                printf("Setting %c...\n", targs[i]);
                razer_convert_ascii_to_pos(targs[i],&pos);
                razer_set_led_pos(kbd->active_device->leds,&pos,&color);
            }
            razer_update_leds(kbd, kbd->active_device->leds);
            printf("Done!\n");

        }

        if(cmd == 3) {
            int ir, ig, ib;
            printf("Enter r g b: ");
            scanf("%u %u %u", &ir, &ig, &ib);
            color.r = ir;
            color.g = ig;
            color.b = ib;
            printf("Setting keys to %u %u %u...\n", ir, ig, ib);
            razer_set_all(kbd->active_device->leds, &color);
            razer_update_leds(kbd, kbd->active_device->leds);
            printf("Done!\n");
        }


        if(cmd==0) break;

    }
    printf("Exiting...");
    razer_close(kbd);
}