struct razer_chroma *razer_open(void)
{
	struct razer_chroma *chroma =(struct razer_chroma*)malloc(sizeof(struct razer_chroma));
	#ifdef USE_DEBUGGING
		printf("opening chroma lib\n");
	#endif
	chroma->sys_mouse_event_path = str_Copy(razer_sys_mouse_event_default_path);
	chroma->sys_keyboard_event_path = str_Copy(razer_sys_keyboard_event_default_path);
	chroma->custom_mode_file = NULL;
	chroma->update_keys_file = NULL;
	chroma->keyboard_input_file = 0;
	chroma->mouse_input_file = 0;
	chroma->device_path = razer_get_device_path();
	if(!chroma->device_path)
	{
		#ifdef USE_DEBUGGING
			printf("error no compatible device found\n");
		#endif
		return(NULL);
	}
	#ifdef USE_VERBOSE_DEBUGGING
		printf("found device at path:%s\n",chroma->device_path);
	#endif

	chroma->keys = (struct razer_keys*)malloc(sizeof(struct razer_keys));
	razer_init_keys(chroma->keys);
	chroma->custom_mode_filename = str_CreateEmpty();
	chroma->custom_mode_filename = str_CatFree(chroma->custom_mode_filename,chroma->device_path);
	chroma->custom_mode_filename = str_CatFree(chroma->custom_mode_filename,razer_custom_mode_pathname);

	chroma->update_keys_filename = str_CreateEmpty();
	chroma->update_keys_filename = str_CatFree(chroma->update_keys_filename,chroma->device_path);
	chroma->update_keys_filename = str_CatFree(chroma->update_keys_filename,razer_update_keys_pathname);
	
	chroma->input_handler = NULL;
	chroma->last_key_pos.x = -1;
	chroma->last_key_pos.y = -1;
	chroma->key_pos.x = -1;
	chroma->key_pos.y = -1;
	return(chroma);
}
int razer_open(struct razer_chroma *chroma)
{
	#ifdef USE_DEBUGGING
		printf("opening chroma lib\n");
	#endif
	chroma->custom_mode_file = NULL;
	chroma->update_keys_file = NULL;
	chroma->input_file = 0;
	chroma->device_path = razer_get_device_path();
	if(!chroma->device_path)
	{
		#ifdef USE_DEBUGGING
			printf("error no compatible device found\n");
		#endif
		return(0);
	}
	#ifdef USE_DEBUGGING
		printf("found device at path:%s\n",chroma->device_path);
	#endif

	chroma->keys = (struct razer_keys*)malloc(sizeof(struct razer_keys));
	razer_init_keys(chroma->keys);

	chroma->custom_mode_filename = (char*)malloc(strlen(chroma->device_path)+strlen(razer_custom_mode_pathname)+1);
	memset(chroma->custom_mode_filename,0,strlen(chroma->device_path)+strlen(razer_custom_mode_pathname)+1);
	memcpy(chroma->custom_mode_filename,chroma->device_path,strlen(chroma->device_path));
	memcpy(chroma->custom_mode_filename+strlen(chroma->device_path),razer_custom_mode_pathname,strlen(razer_custom_mode_pathname));
	chroma->update_keys_filename = (char*)malloc(strlen(chroma->device_path)+strlen(razer_update_keys_pathname)+1);
	memset(chroma->update_keys_filename,0,strlen(chroma->device_path)+strlen(razer_update_keys_pathname)+1);
	memcpy(chroma->update_keys_filename,chroma->device_path,strlen(chroma->device_path));
	memcpy(chroma->update_keys_filename+strlen(chroma->device_path),razer_update_keys_pathname,strlen(razer_update_keys_pathname));

	chroma->input_handler = NULL;
	chroma->last_key_pos.x = -1;
	chroma->last_key_pos.y = -1;
	chroma->key_pos.x = -1;
	chroma->key_pos.y = -1;
	return(1);
}