Example #1
0
void
set_input(const char *name)
{
	static int set = 0;
	module_conf_t *ml, *m;
	
	if (set)
		return;
	set = 1;

	if (NULL == name || !strcasecmp(name, "list")) {
		list_input();
		exit(0);
	}
	
	ml = parse_module_param(name);

	for (m = ml; m; m = m->next) {
		preferred = get_input_module(ml->name);

		if (NULL == preferred)
			continue;

		if (preferred->im_set_opts)
			preferred->im_set_opts(ml->attrs);

		if (preferred->im_probe)
			if (preferred->im_probe())
				return;
	}

	quit("No (working) input module found\n");
}
void
dmz::InputPluginChannelSwitch::receive_key_event (
      const Handle Channel,
      const InputEventKey &Value) {

   if ((Value.get_key () == KeyTab) && Value.get_key_state ()) {

      if (_current) { _current = _current->next; }

      if (!_current) { _current = _list; }

      if (_current) {

         InputModule *input (get_input_module ());

         if (input) {

            input->set_channel_state (_current->Channel, True);

//            ChannelStruct *current (_list);

//            while (current) {

//               if (current->Channel != _current->Channel) {

//                  input->set_channel_state (current->Channel, False);
//               }

//               current = current->next;
//            }
         }
      }
   }
}
Example #3
0
static void
find_preferred(void)
{
	if (NULL == preferred) {
		struct input_module *i;
		/*
		 * User has not chosen a output module
		 */

#if defined SYS_SUNOS
		preferred = get_input_module("kstat");
#elif defined SYS_BSD
		preferred = get_input_module("sysctl");
#elif defined SYS_LINUX
		preferred = get_input_module("netlink");

		if (NULL == preferred)
			preferred = get_input_module("proc");

		if (NULL == preferred)
			preferred = get_input_module("sysfs");
#endif

		if (NULL == preferred) {
			for (i = reg_pri_list; i; i = i->im_next) {
				if (i->im_no_default) {
					preferred = i;
					break;
				}
			}
		}

		if (NULL == preferred)
			quit("No input method found\n");
	}
}