eeze: add v4l device discovery.

SVN revision: 61410
This commit is contained in:
Cedric BAIL 2011-07-15 17:28:13 +00:00
parent 56f7ba4751
commit afa692034f
4 changed files with 37 additions and 1 deletions

View File

@ -204,6 +204,25 @@ main()
eina_stringshare_del(name);
}
printf("\nGot any v4l device ?\n");
/* find all V4L device, may be a webcam or anything that can get a video
* stream from the real worl in a numerical form */
type = eeze_udev_find_by_type(EEZE_UDEV_TYPE_V4L, NULL);
type = eeze_udev_find_unlisted_similar(type);
EINA_LIST_FREE(type, name) /* get a device name using the device's syspath */
{
if ((check = eeze_udev_syspath_get_property(name, "DEVNAME")))
{
if ((check2 = eeze_udev_syspath_get_sysattr(name, "name")))
{
printf("%s: '%s' [%s]\n", name, check2, check);
eina_stringshare_del(check2);
}
eina_stringshare_del(check);
}
eina_stringshare_del(name);
}
/* set a udev watch, grab all events because no EEZE_UDEV_TYPE filter is specified,
* set the events to be sent to callback function catch_events(), and attach
* kbdmouse to the watch as associated data

View File

@ -214,7 +214,9 @@ typedef enum
/** - Temperature sensor */
EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR,
/** - Network devices */
EEZE_UDEV_TYPE_NET
EEZE_UDEV_TYPE_NET,
/** - WebCam */
EEZE_UDEV_TYPE_V4L
} Eeze_Udev_Type;
/**@}*/

View File

@ -233,6 +233,9 @@ eeze_udev_find_by_type(Eeze_Udev_Type etype,
udev_enumerate_add_match_property(en, "ID_MODEL", "Android_*");
break;
*/
case EEZE_UDEV_TYPE_V4L:
udev_enumerate_add_match_subsystem(en, "video4linux");
break;
default:
break;
}

View File

@ -267,6 +267,13 @@ _get_syspath_from_watch(void *data,
break;
case EEZE_UDEV_TYPE_V4L:
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "video4linux")))
goto error;
break;
default:
break;
}
@ -343,6 +350,11 @@ eeze_udev_watch_add(Eeze_Udev_Type type,
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
break;
*/
case EEZE_UDEV_TYPE_V4L:
udev_monitor_filter_add_match_subsystem_devtype(mon, "video4linux",
NULL);
break;
default:
break;
}