Exemple #1
0
static int list_devices()
{
	BList list;
	BInputDevice *device;
	int i, n;
	status_t err;

	printf("         name                  type         state \n");
	printf("--------------------------------------------------\n");

	if ((err = get_input_devices(&list))!=B_OK) {
		fprintf(stderr, "error while get_input_devices: %s\n", strerror(err));
		return -1;
	}

	n = list.CountItems();
	if (n == 0) {
		printf("...no input devices found...\n");
	}

	for (i = 0; i < n; i++) {
		device = (BInputDevice *) list.ItemAt(i);

		printf("%23s %18s %7s\n",
			device->Name(),
			device->Type() == B_POINTING_DEVICE ? "B_POINTING_DEVICE" :
			device->Type() == B_KEYBOARD_DEVICE ? "B_KEYBOARD_DEVICE" : "B_UNDEFINED_DEVICE",
			device->IsRunning() ? "running" : "stopped");
	}

	return 0;
}
Exemple #2
0
void hd_scan_input(hd_data_t *hd_data)
{
  if(!hd_probe_feature(hd_data, pr_input)) return;

  hd_data->module = mod_input;

  /* some clean-up */
  remove_hd_entries(hd_data);

  PROGRESS(1, 0, "joydev mod");
  load_module(hd_data, "joydev");

  PROGRESS(1, 1, "evdev mod");
  load_module(hd_data, "evdev");

  PROGRESS(2, 0, "input");

  get_input_devices(hd_data);
}
Exemple #3
0
status_t
TouchpadPref::ConnectToTouchPad()
{
	BList devList;
	status_t status = get_input_devices(&devList);
	if (status != B_OK)
		return status;

	int32 i = 0;
	while (true) {
		BInputDevice* dev = (BInputDevice*)devList.ItemAt(i);
		if (dev == NULL)
			break;
		i++;

		LOG("input device %s\n", dev->Name());

		BString name = dev->Name();

		if (name.FindFirst("Touchpad") >= 0
			&& dev->Type() == B_POINTING_DEVICE
			&& !fConnected) {
			fConnected = true;
			fTouchPad = dev;
			// Don't bail out here, since we need to delete the other devices
			// yet.
		} else {
			delete dev;
		}
	}
	if (fConnected)
		return B_OK;

	LOG("touchpad input device NOT found\n");
	return B_ENTRY_NOT_FOUND;
}