New lib for EFL: eeze! Bringing you the freedom to (hopefully) never need to learn external apis again!

So far only e_udev is complete, but more will be added.  Add stuff to the TODO or yell at me in irc if you want something in.
If anyone knows how to fix the doxygen css, I'd be most grateful!


SVN revision: 48808
This commit is contained in:
Mike Blumenkrantz 2010-05-13 10:49:17 +00:00
parent 141a2bb9a8
commit 7c28e4ce29
37 changed files with 2787 additions and 0 deletions

1
legacy/eeze/AUTHORS Normal file
View File

@ -0,0 +1 @@
Mike Blumenkrantz (zmike/discomfitor) mike@zentific.com

20
legacy/eeze/COPYING Normal file
View File

@ -0,0 +1,20 @@
Copyright (C) 2010 Mike Blumenkrantz and various contributors (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies of the Software, its documentation and marketing & publicity
materials, and acknowledgment shall be given in the documentation, materials
and software packages that this Software was used.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0
legacy/eeze/ChangeLog Normal file
View File

302
legacy/eeze/INSTALL Normal file
View File

@ -0,0 +1,302 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
6. Often, you can also type `make uninstall' to remove the installed
files again.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *Note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

22
legacy/eeze/Makefile.am Normal file
View File

@ -0,0 +1,22 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src doc
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.log config.sub configure depcomp \
install-sh ltmain.sh missing compile eeze*doc*tar* \
m4/l*
pkgconfigdir = $(libdir)/pkgconfig
if BUILD_EUDEV
EUDEV_PC = eudev.pc
endif
pkgconfig_DATA = $(EUDEV_PC)
.PHONY: doc
doc: all
@echo "entering doc/"
$(MAKE) -C doc doc

0
legacy/eeze/NEWS Normal file
View File

3
legacy/eeze/README Normal file
View File

@ -0,0 +1,3 @@
eeze v?.??
eeze is a collection of misc apis wrapped in efl for ease of integration with other efl projects. Dependencies may vary, use at your own risk, i before e except after c.

9
legacy/eeze/TODO Normal file
View File

@ -0,0 +1,9 @@
udev: switch enum to bitmasks with categories probably
documentation for all types
more functions or something?
TO BE ADDED
mpd: implement efl mpd bindings
xen: common xen control/info functions
libvirt: same as above
???

16
legacy/eeze/autogen.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
rm -rf autom4te.cache
rm -f aclocal.m4 ltmain.sh
touch README
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
echo "Running autoheader..." ; autoheader || exit 1
echo "Running autoconf..." ; autoconf || exit 1
echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
echo "Running automake..." ; automake --add-missing --copy || exit 1
if [ -z "$NOCONFIGURE" ]; then
./configure "$@"
fi

105
legacy/eeze/configure.ac Normal file
View File

@ -0,0 +1,105 @@
# get rid of that stupid cache mechanism
rm -f config.cache
AC_INIT([eeze], [0.0.1], [enlightenment-devel@lists.sourceforge.net])
release="ver-pre-svn-05"
AC_PREREQ([2.52])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.6 dist-bzip2])
AM_CONFIG_HEADER([config.h])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PROG_CC
AC_HEADER_STDC
AM_PROG_CC_C_O
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
AC_PROG_LIBTOOL
VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
eudev_release_info="-release $release"
AC_SUBST(version_info)
AC_SUBST(eudev_release_info)
dnl Check enabled modules to build
AC_ARG_ENABLE([eudev],[AC_HELP_STRING([--disable-eudev], [Disable eudev build])])
AS_IF(
[test "x$enableval" != "xno"],
[enable_eudev="yes"],
[enable_eudev=no],
)
# pkg-config
PKG_PROG_PKG_CONFIG
# Check whether pkg-config supports Requires.private
AS_IF(
[$PKG_CONFIG --atleast-pkgconfig-version 0.22],
[pkgconfig_requires_private="Requires.private"],
[pkgconfig_requires_private="Requires"]
)
AC_SUBST(pkgconfig_requires_private)
PKG_CHECK_MODULES([ECORE], [ecore])
AS_IF(
[test "x${enable_eudev}" = "xyes"],
[PKG_CHECK_MODULES(UDEV, libudev, [], [enable_eudev="no"])]
)
AM_CONDITIONAL([BUILD_EUDEV], [test "x${enable_eudev}" = "xyes"])
EFL_EDBUS_BUILD=""
lt_enable_auto_import=""
AS_CASE(
["$host_os"],
[mingw* | cegcc*],
AC_MSG_ERROR([THIS WILL NOT RUN ON WINDOWS!])
)
EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
AC_OUTPUT([
Makefile
doc/eeze.dox
doc/Makefile
src/Makefile
src/lib/Makefile
src/lib/udev/Makefile
src/bin/Makefile
eudev.pc
])
#####################################################################
## Info
echo
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo "Configuration Options Summary:"
echo
echo " Modules:"
echo
echo " EUdev..............: $enable_eudev"
echo
echo "Compilation............: make (or gmake)"
echo " CPPFLAGS.............: $CPPFLAGS"
echo " CFLAGS...............: $CFLAGS"
echo " LDFLAGS..............: $LDFLAGS"
echo
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...............: $prefix"
echo

141
legacy/eeze/doc/Doxyfile Normal file
View File

@ -0,0 +1,141 @@
ALIASES =
ALLEXTERNALS = NO
ALPHABETICAL_INDEX = YES
ALWAYS_DETAILED_SEC = NO
BINARY_TOC = NO
BRIEF_MEMBER_DESC = YES
CASE_SENSE_NAMES = YES
CHM_FILE =
CLASS_DIAGRAMS = NO
CLASS_GRAPH = NO
COLLABORATION_GRAPH = NO
COLS_IN_ALPHA_INDEX = 2
COMPACT_LATEX = NO
COMPACT_RTF = NO
DETAILS_AT_TOP = NO
DISABLE_INDEX = YES
DISTRIBUTE_GROUP_DOC = NO
DOT_CLEANUP = YES
DOTFILE_DIRS =
DOT_IMAGE_FORMAT = png
DOT_PATH =
ENABLED_SECTIONS =
ENABLE_PREPROCESSING = YES
ENUM_VALUES_PER_LINE = 1
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
EXCLUDE =
EXCLUDE_PATTERNS =
EXCLUDE_SYMLINKS = NO
EXPAND_AS_DEFINED =
EXPAND_ONLY_PREDEF = NO
EXTERNAL_GROUPS = YES
EXTRACT_ALL = NO
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRA_PACKAGES =
FILE_PATTERNS =
FILTER_SOURCE_FILES = NO
FULL_PATH_NAMES = NO
GENERATE_AUTOGEN_DEF = NO
GENERATE_BUGLIST = YES
GENERATE_CHI = NO
GENERATE_DEPRECATEDLIST= YES
GENERATE_HTMLHELP = NO
GENERATE_HTML = YES
GENERATE_LATEX = YES
GENERATE_LEGEND = YES
GENERATE_MAN = YES
GENERATE_RTF = NO
GENERATE_TAGFILE =
GENERATE_TESTLIST = YES
GENERATE_TODOLIST = YES
GENERATE_TREEVIEW = NO
GENERATE_XML = NO
GRAPHICAL_HIERARCHY = NO
HAVE_DOT = NO
HHC_LOCATION =
HIDE_FRIEND_COMPOUNDS = YES
HIDE_SCOPE_NAMES = NO
HIDE_UNDOC_CLASSES = YES
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_RELATIONS = YES
HTML_ALIGN_MEMBERS = YES
HTML_FILE_EXTENSION = .html
HTML_FOOTER = foot.html
HTML_HEADER = head.html
HTML_OUTPUT = html
HTML_STYLESHEET = e.css
IGNORE_PREFIX =
IMAGE_PATH = img
INCLUDED_BY_GRAPH = NO
INCLUDE_FILE_PATTERNS =
INCLUDE_GRAPH = NO
INCLUDE_PATH =
INHERIT_DOCS = YES
INLINE_INFO = YES
INLINE_INHERITED_MEMB = NO
INLINE_SOURCES = NO
INPUT = eeze.dox ../src/lib
INPUT_FILTER =
INTERNAL_DOCS = NO
JAVADOC_AUTOBRIEF = YES
LATEX_BATCHMODE = NO
LATEX_CMD_NAME = latex
LATEX_HEADER =
LATEX_OUTPUT = latex
MACRO_EXPANSION = NO
MAKEINDEX_CMD_NAME = makeindex
MAN_EXTENSION = .3
MAN_LINKS = YES
MAN_OUTPUT = man
MAX_DOT_GRAPH_HEIGHT = 512
MAX_DOT_GRAPH_WIDTH = 512
MAX_INITIALIZER_LINES = 30
MULTILINE_CPP_IS_BRIEF = NO
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OUTPUT_DIRECTORY = .
OUTPUT_LANGUAGE = English
PAPER_TYPE = a4wide
PDF_HYPERLINKS = YES
PERL_PATH = /usr/bin/perl
PREDEFINED =
PROJECT_NAME = Eeze
PROJECT_NUMBER =
QUIET = NO
RECURSIVE = YES
REFERENCES_LINK_SOURCE = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REPEAT_BRIEF = YES
RTF_EXTENSIONS_FILE =
RTF_HYPERLINKS = NO
RTF_OUTPUT = rtf
RTF_STYLESHEET_FILE =
SEARCHENGINE = NO
SEARCH_INCLUDES = YES
SHORT_NAMES = NO
SHOW_INCLUDE_FILES = NO
SHOW_USED_FILES = NO
SKIP_FUNCTION_MACROS = YES
SORT_MEMBER_DOCS = YES
SOURCE_BROWSER = NO
STRIP_CODE_COMMENTS = YES
STRIP_FROM_PATH = src/
SUBGROUPING = YES
TAB_SIZE = 2
TAGFILES =
TEMPLATE_RELATIONS = NO
TOC_EXPAND = NO
TREEVIEW_WIDTH = 250
USE_PDFLATEX = NO
VERBATIM_HEADERS = NO
WARN_FORMAT = "$file:$line: $text"
WARN_IF_UNDOCUMENTED = YES
WARNINGS = YES
WARN_LOGFILE =
XML_DTD =
XML_SCHEMA =

View File

@ -0,0 +1,32 @@
MAINTAINERCLEANFILES = Makefile.in eeze.dox
.PHONY: doc
PACKAGE_DOCNAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-doc
if EFL_BUILD_DOC
doc-clean:
rm -rf html/ latex/ man/ xml/ $(PACKAGE_DOCNAME).tar*
doc: all doc-clean
$(efl_doxygen)
cp img/* html/
rm -rf $(PACKAGE_DOCNAME).tar*
mkdir -p $(PACKAGE_DOCNAME)/doc
cp -R html/ latex/ man/ $(PACKAGE_DOCNAME)/doc
tar cf $(PACKAGE_DOCNAME).tar $(PACKAGE_DOCNAME)/
bzip2 -9 $(PACKAGE_DOCNAME).tar
rm -rf $(PACKAGE_DOCNAME)/
mv $(PACKAGE_DOCNAME).tar.bz2 $(top_srcdir)
clean-local: doc-clean
else
doc:
@echo "Documentation not built. Run ./configure --help"
endif
EXTRA_DIST = Doxyfile $(wildcard img/*.*) e.css head.html foot.html eeze.dox.in

273
legacy/eeze/doc/e.css Normal file
View File

@ -0,0 +1,273 @@
/*
Author:
Andres Blanc <andresblanc@gmail.com>
DaveMDS Andreoli <dave@gurumeditation.it>
Supported Browsers:
ie7, opera9, konqueror4 and firefox3
Please use a different file for ie6, ie5, etc. hacks.
*/
/* Necessary to place the footer at the bottom of the page */
html, body {
height: 100%;
margin: 0px;
padding: 0px;
}
#container {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -53px;
}
#footer, #push {
height: 53px;
}
* html #container {
height: 100%;
}
/* Prevent floating elements overflowing containers */
.clear {
clear: both;
width: 0px;
height: 0px;
}
/* Flexible & centered layout from 750 to 960 pixels */
.layout {
max-width: 960px;
min-width: 760px;
margin-left: auto;
margin-right: auto;
}
body {
/*font-family: Lucida Grande, Helvetica, sans-serif;*/
font-family: "Bitstream Vera","Vera","Trebuchet MS",Trebuchet,Tahoma,sans-serif
}
/* Prevent design overflowing the viewport in small resolutions */
#container {
padding-right: 17px;
padding-left: 17px;
background-image: url(head_bg.png);
background-repeat: repeat-x;
}
/****************************/
/* Top main menu */
/****************************/
#header_logo {
background-image : url(logo.png);
width : 61px;
}
#header_logo a {
position : absolute;
border : 0px;
background-color : transparent;
top : 0px;
width : 60px;
height : 60px;
}
#header_menu {
background-image : url(header_menu_background.png);
font : normal 10pt verdana,'Bitstream Vera Sans',helvetica,arial,sans-serif;
text-align : right;
}
#header_last {
background-image : url(header_menu_background_last.png);
width : 15px;
}
td.nav_passive {
background : url(header_menu_unselected_background.png) 0 0 no-repeat;
height : 63px;
font-family : "Bitstream Vera","Vera","Trebuchet MS",Trebuchet,Tahoma,sans-serif;
font-size : 11px;
padding : 20px 10px 20px 10px;
vertical-align : middle;
}
td.nav_active {
background : url(header_menu_current_background.png) 0 0 no-repeat;
height : 63px;
color : #646464;
font-family : "Bitstream Vera","Vera","Trebuchet MS",Trebuchet,Tahoma,sans-serif;
font-size : 11px;
font-weight : bold;
padding : 20px 10px 20px 10px;
vertical-align : middle;
}
#header_menu a {
display : block;
text-decoration : none;
cursor : pointer;
color : #cdcdcd;
}
#header {
width: 100%;
height: 102px;
}
#header h1 {
width: 63px;
height: 63px;
position: absolute;
margin: 0px;
}
#header h1 span {
display: none;
}
#header h2 {
display: none;
}
/* .menu-container is used to set properties common to .menu and .submenu */
#header .menu-container {
}
#header .menu-container ul {
list-style-type: none;
list-style-position: inside;
margin: 0;
}
#header .menu-container li {
display: block;
float: right;
}
#header .menu {
height: 63px;
display: block;
background-image: url(menu_bg.png);
background-repeat: repeat-x;
}
#header .menu ul {
height: 100%;
display: block;
background-image: url(menu_bg_last.png);
background-repeat: no-repeat;
background-position: top right;
padding-right: 17px;
}
#header .menu li {
height: 100%;
text-align: center;
background-image: url(menu_bg_unsel.png);
background-repeat: no-repeat;
}
#header .menu a {
height: 100%;
display: block;
color: #cdcdcd;
text-decoration: none;
font-size: 10pt;
line-height: 59px;
text-align: center;
padding: 0px 15px 0px 15px;
}
#header .menu li:hover {
background-image: url(menu_bg_hover.png);
background-repeat: no-repeat;
}
#header .menu li:hover a {
color: #FFFFFF;
}
#header .menu li.current {
background-image: url(menu_bg_current.png);
background-repeat: no-repeat;
}
#header .menu li.current a {
color: #646464;
}
/* Hide all the submenus but the current */
#header .submenu ul {
display: none;
}
#header .submenu .current {
display: block;
}
#header .submenu {
font: bold 10px verdana,'Bitstream Vera Sans',helvetica,arial,sans-serif;
margin-top: 10px;
}
#header .submenu a {
color: #888888;
text-decoration: none;
font-size: 0.9em;
line-height: 15px;
padding:0px 5px 0px 5px;
}
#header .submenu a:hover {
color: #444444;
}
#header .submenu li {
border-left: 1px solid #DDDDDD;
}
#header .submenu li:last-child {
border-left: 0;
}
#header .doxytitle {
position: absolute;
font-size: 1.8em;
font-weight: bold;
color: #444444;
line-height: 35px;
}
#header small {
font-size: 0.4em;
}
#footer {
background-image: url(foot_bg.png);
width: 100%;
}
#footer table {
width: 100%;
text-align: center;
white-space: nowrap;
padding: 5px 30px 5px 30px;
font-size: 0.8em;
font-family: "Bitstream Vera","Vera","Trebuchet MS",Trebuchet,Tahoma,sans-serif;
color: #888888;
}
#footer td.copyright {
width: 100%;
}

View File

@ -0,0 +1,23 @@
/**
@file eeze.dox
@brief Eeze Misc Libraries
*/
/**
@mainpage Eeze
@image html eeze.png
@version @PACKAGE_VERSION@
@author Mike Blumenkrantz (zmike/discomfitor) <mike@zentific.com>
@date 2010
@section intro What is Eeze?
Eeze is a collection of various APIs which may or may not be useful
to developers working with EFL. The aim is to eliminate the need to
learn any api outside of EFL while simultaneously providing an
extremely easy way to manipulate external libraries.
@verbatim
Pants
@endverbatim
*/

18
legacy/eeze/doc/foot.html Normal file
View File

@ -0,0 +1,18 @@
<div id="push"></div>
</div> <!-- #content -->
</div> <!-- .layout -->
</div> <!-- #container -->
<div id="footer">
<table><tr>
<td class="copyright">Copyright &copy;$year Enlightenment</td>
<td class="generated">Docs generated $datetime</td>
</tr></table>
</div>
</body>
</html>

68
legacy/eeze/doc/head.html Normal file
View File

@ -0,0 +1,68 @@
<html>
<head>
<title>$title</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta name="author" content="Andres Blanc" >
<link rel="icon" href="img/favicon.png" type="image/x-icon">
<link rel="shortcut icon" href="img/favicon.png" type="image/x-icon">
<link rel="icon" href="img/favicon.png" type="image/ico">
<link rel="shortcut icon" href="img/favicon.png" type="image/ico">
<link rel="stylesheet" type="text/css" href="e.css">
<link rel="stylesheet" type="text/css" href="edoxy.css">
</head>
<body>
<div id="container">
<div id="header">
<div class="layout">
<h1><span>Enlightenment</span></h1>
<h2><span>Beauty at your fingertips</span></h2>
<table cellspacing="0" cellpadding="0" width="100%"><tr>
<td id="header_logo">
<a href="http://www.enlightenment.org"></a>
</td>
<td id="header_menu">
<table cellspacing="0" cellpadding="0" align="right"><tr>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=home">Home</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=news">News</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=about">About</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=download">Download</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=support">Support</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=contribute">Contribute</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=contact">Contact</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://trac.enlightenment.org/e">Tracker</a></td>
<td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=docs">Docs</a></td>
</tr></table>
</td>
<td id="header_last"></td>
</tr></table>
<div class="doxytitle">
$projectname Documentation <small>at $date</small>
</div>
<div class="menu-container">
<div class="submenu">
<ul class="current">
<li><a href="files.html">Files</a></li>
<li><a href="globals.html">Globals</a></li>
<li><a href="Eeze_8h.html">API Reference</a></li>
<li><a href="modules.html">Modules</a></li>
<li class="current"><a href="index.html">Main Page</a></li>
</ul>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div id="content">
<div class="layout">

View File

@ -0,0 +1,486 @@
/*
* This file contain a custom doxygen style to match e.org graphics
*/
/* BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
font-family: Geneva, Arial, Helvetica, sans-serif;
}*/
BODY, TD {
font-size: 12px;
}
H1 {
text-align: center;
font-size: 160%;
}
H2 {
font-size: 120%;
}
H3 {
font-size: 100%;
}
CAPTION {
font-weight: bold
}
DIV.qindex {
width: 100%;
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
DIV.navpath {
width: 100%;
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
DIV.navtab {
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
TD.navtab {
font-size: 70%;
}
A.qindex {
text-decoration: none;
font-weight: bold;
color: #1A419D;
}
A.qindex:visited {
text-decoration: none;
font-weight: bold;
color: #1A419D
}
A.qindex:hover {
text-decoration: none;
background-color: #ddddff;
}
A.qindexHL {
text-decoration: none;
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
border: 1px double #9295C2;
}
A.qindexHL:hover {
text-decoration: none;
background-color: #6666cc;
color: #ffffff;
}
A.qindexHL:visited {
text-decoration: none;
background-color: #6666cc;
color: #ffffff
}
A.el {
text-decoration: none;
font-weight: bold
}
A.elRef {
font-weight: bold
}
A.code:link {
text-decoration: none;
font-weight: normal;
color: #0000FF
}
A.code:visited {
text-decoration: none;
font-weight: normal;
color: #0000FF
}
A.codeRef:link {
font-weight: normal;
color: #0000FF
}
A.codeRef:visited {
font-weight: normal;
color: #0000FF
}
A:hover, A:visited:hover {
text-decoration: none;
/* background-color: #f2f2ff; */
color: #000055;
}
A.anchor {
color: #000;
}
DL.el {
margin-left: -1cm
}
.fragment {
font-family: monospace, fixed;
font-size: 95%;
}
PRE.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
margin-top: 4px;
margin-bottom: 4px;
margin-left: 2px;
margin-right: 8px;
padding-left: 6px;
padding-right: 6px;
padding-top: 4px;
padding-bottom: 4px;
}
DIV.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px
}
DIV.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}
DIV.groupText {
margin-left: 16px;
font-style: italic;
font-size: 90%
}
/*BODY {
background: white;
color: black;
margin-right: 20px;
margin-left: 20px;
}*/
TD.indexkey {
background-color: #e8eef2;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
TD.indexvalue {
background-color: #e8eef2;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
TR.memlist {
background-color: #f0f0f0;
}
P.formulaDsp {
text-align: center;
}
IMG.formulaDsp {
}
IMG.formulaInl {
vertical-align: middle;
}
SPAN.keyword { color: #008000 }
SPAN.keywordtype { color: #604020 }
SPAN.keywordflow { color: #e08000 }
SPAN.comment { color: #800000 }
SPAN.preprocessor { color: #806020 }
SPAN.stringliteral { color: #002080 }
SPAN.charliteral { color: #008080 }
SPAN.vhdldigit { color: #ff00ff }
SPAN.vhdlchar { color: #000000 }
SPAN.vhdlkeyword { color: #700070 }
SPAN.vhdllogic { color: #ff0000 }
.mdescLeft {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.mdescRight {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.memItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplParams {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
color: #606060;
background-color: #FAFAFA;
font-size: 80%;
}
.search {
color: #003399;
font-weight: bold;
}
FORM.search {
margin-bottom: 0px;
margin-top: 0px;
}
INPUT.search {
font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
TD.tiny {
font-size: 75%;
}
a {
color: #1A41A8;
}
a:visited {
color: #2A3798;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
border: 1px solid #84b0c7;
}
TH.dirtab {
background: #e8eef2;
font-weight: bold;
}
HR {
height: 1px;
border: none;
border-top: 1px solid black;
}
/* Style for detailed member documentation */
.memtemplate {
font-size: 80%;
color: #606060;
font-weight: normal;
margin-left: 3px;
}
.memnav {
background-color: #eeeeee;
border: 1px solid #dddddd;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
.memitem {
padding: 4px;
background-color: #eeeeee;
border-width: 1px;
border-style: solid;
border-color: #dddddd;
-moz-border-radius: 4px 4px 4px 4px;
}
.memname {
white-space: nowrap;
font-weight: bold;
color: #ffffff;
}
.memdoc{
padding-left: 10px;
}
.memproto {
background-color: #111111;
width: 100%;
border-width: 1px;
border-style: solid;
border-color: #000000;
font-weight: bold;
-moz-border-radius: 4px 4px 4px 4px;
}
.paramkey {
text-align: right;
color: #ffffff;
}
.paramtype {
white-space: nowrap;
color: #aaaaaa;
}
.paramname {
color: #ff0000;
font-style: italic;
white-space: nowrap;
}
/* End Styling for detailed member documentation */
/* for the tree view */
.ftvtree {
font-family: sans-serif;
margin:0.5em;
}
/* these are for tree view when used as main index */
.directory {
font-size: 9pt;
font-weight: bold;
}
.directory h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
/* The following two styles can be used to replace the root node title */
/* with an image of your choice. Simply uncomment the next two styles, */
/* specify the name of your image and be sure to set 'height' to the */
/* proper pixel height of your image. */
/* .directory h3.swap { */
/* height: 61px; */
/* background-repeat: no-repeat; */
/* background-image: url("yourimage.gif"); */
/* } */
/* .directory h3.swap span { */
/* display: none; */
/* } */
.directory > h3 {
margin-top: 0;
}
.directory p {
margin: 0px;
white-space: nowrap;
}
.directory div {
display: none;
margin: 0px;
}
.directory img {
vertical-align: -30%;
}
/* these are for tree view when not used as main index */
.directory-alt {
font-size: 100%;
font-weight: bold;
}
.directory-alt h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
.directory-alt > h3 {
margin-top: 0;
}
.directory-alt p {
margin: 0px;
white-space: nowrap;
}
.directory-alt div {
display: none;
margin: 0px;
}
.directory-alt img {
vertical-align: -30%;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

11
legacy/eeze/eudev.pc.in Normal file
View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: eudev
Description: udev convenience library for efl
@pkgconfig_requires_private@: ecore libudev
Version: @VERSION@
Libs: -L${libdir} -leudev
Cflags: -I${includedir}

View File

@ -0,0 +1,99 @@
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
dnl That code is public domain and can be freely used or copied.
dnl Macro that check if doxygen is available or not.
dnl EFL_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for the doxygen program
dnl Defines efl_doxygen
dnl Defines the automake conditionnal EFL_BUILD_DOC
dnl
AC_DEFUN([EFL_CHECK_DOXYGEN],
[
dnl
dnl Disable the build of the documentation
dnl
AC_ARG_ENABLE([doc],
[AC_HELP_STRING(
[--disable-doc],
[Disable documentation build @<:@default=enabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
efl_enable_doc="yes"
else
efl_enable_doc="no"
fi
],
[efl_enable_doc="yes"])
AC_MSG_CHECKING([whether to build documentation])
AC_MSG_RESULT([${efl_enable_doc}])
if test "x${efl_enable_doc}" = "xyes" ; then
dnl
dnl Specify the file name, without path
dnl
efl_doxygen="doxygen"
AC_ARG_WITH([doxygen],
[AC_HELP_STRING(
[--with-doxygen=FILE],
[doxygen program to use @<:@default=doxygen@:>@])],
dnl
dnl Check the given doxygen program.
dnl
[efl_doxygen=${withval}
AC_CHECK_PROG([efl_have_doxygen],
[${efl_doxygen}],
[yes],
[no])
if test "x${efl_have_doxygen}" = "xno" ; then
echo "WARNING:"
echo "The doxygen program you specified:"
echo "${efl_doxygen}"
echo "was not found. Please check the path and make sure "
echo "the program exists and is executable."
AC_MSG_WARN([no doxygen detected. Documentation will not be built])
fi
],
[AC_CHECK_PROG([efl_have_doxygen],
[${efl_doxygen}],
[yes],
[no])
if test "x${efl_have_doxygen}" = "xno" ; then
echo "WARNING:"
echo "The doxygen program was not found in your execute path."
echo "You may have doxygen installed somewhere not covered by your path."
echo ""
echo "If this is the case make sure you have the packages installed, AND"
echo "that the doxygen program is in your execute path (see your"
echo "shell manual page on setting the \$PATH environment variable), OR"
echo "alternatively, specify the program to use with --with-doxygen."
AC_MSG_WARN([no doxygen detected. Documentation will not be built])
fi
])
fi
dnl
dnl Substitution
dnl
AC_SUBST([efl_doxygen])
if ! test "x${efl_have_doxygen}" = "xyes" ; then
efl_enable_doc="no"
fi
AM_CONDITIONAL(EFL_BUILD_DOC, test "x${efl_enable_doc}" = "xyes")
if test "x${efl_enable_doc}" = "xyes" ; then
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
])
dnl End of doxygen.m4

View File

@ -0,0 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = lib bin

View File

@ -0,0 +1,21 @@
MAINTAINERCLEANFILES = Makefile.in
EEZE_CPPFLAGS = \
-I$(top_srcdir)/src/lib/udev \
@ECORE_CFLAGS@
LIBS = \
@ECORE_LIBS@
if BUILD_EUDEV
EUDEV_PROG = eeze_udev_test
endif
bin_PROGRAMS = \
$(EUDEV_PROG)
if BUILD_EUDEV
eeze_udev_test_SOURCES = eeze_udev_test.c
eeze_udev_test_CPPFLAGS = $(EEZE_CPPFLAGS)
eeze_udev_test_LDADD = $(top_builddir)/src/lib/udev/libeudev.la
endif

View File

@ -0,0 +1,162 @@
#include <E_Udev.h>
#include <Ecore.h>
#include <stdio.h>
typedef struct kbdmouse
{
Eina_List *kbds;
Eina_List *mice;
Eina_Hash *hash;
} kbdmouse;
static void
/* event will always be a syspath starting with /sys */
catch_events(const char *event, void *data, Eudev_Watch *watch)
{
kbdmouse *akbdmouse = data;
Eina_List *l;
const char *name, *dev, *type;
int new = 0;
/* the event that comes through will be prefixed by "/sys"
* but the saved name will not, so we check for the saved name
* inside the event name
*/
EINA_LIST_FOREACH(akbdmouse->kbds, l, name)
if (strstr(event, name)) goto end;
EINA_LIST_FOREACH(akbdmouse->mice, l, name)
if (strstr(event, name)) goto end;
/* check to see if the device was just plugged in */
if (e_udev_syspath_is_kbd(event) || e_udev_syspath_is_mouse(event))
{
new = 1;
goto end;
}
/* if we reach here, the event is neither a keyboard nor a mouse that we saw
* previously, so we print a moderately amusing message and bail
*/
printf("Sneaky sneaky! But %s is not a keyboard or a mouse!!\n", event);
return;
end:
/* we stored the devpaths for all the syspaths previously so that
* we can retrieve them now even though the device has been removed and
* is inaccessible to udev
*/
if (new)
{
dev = e_udev_syspath_get_devpath(event);
type = "plugged in";
}
else
{
dev = eina_hash_find(akbdmouse->hash, name);
type = "unplugged";
}
printf("You %s %s!\n", type, dev);
printf("All tests completed, exiting successfully!\n");
/* now we free the lists */
eina_list_free(akbdmouse->kbds);
eina_list_free(akbdmouse->mice);
/* and the hash */
eina_hash_free(akbdmouse->hash);
/* and the random storage struct */
free(akbdmouse);
/* and quit the main loop */
ecore_main_loop_quit();
/* and delete the watch */
e_udev_watch_del(watch);
/* and shut down eudev */
e_udev_shutdown();
}
static void
hash_free(void *data)
{
eina_stringshare_del(data);
}
int main()
{
Eina_List *type, *l;
const char *name, *check;
kbdmouse *akbdmouse;
Eina_Hash *hash;
ecore_init();
e_udev_init();
hash = eina_hash_stringshared_new(hash_free);
akbdmouse = malloc(sizeof(kbdmouse));
akbdmouse->hash = hash;
printf("For my first trick, I will find all of your keyboards and return their syspaths.\n");
/* find all keyboards using type EUDEV_TYPE_KEYBOARD */
type = e_udev_find_by_type(EUDEV_TYPE_KEYBOARD, NULL);
EINA_LIST_FOREACH(type, l, name)
{ /* add the devpath to the hash for use in the cb later */
eina_hash_direct_add(hash, name, e_udev_syspath_get_devpath(name));
printf("Found keyboard: %s\n", name);
}
/* we save this list for later, because once a device is unplugged it can
* no longer be detected by udev, and any related properties are unusable unless
* they have been previously stored
*/
akbdmouse->kbds = type;
printf("\nNext, I will find all of your mice and print the corresponding manufacturer.\n");
/* find all mice using type EUDEV_TYPE_MOUSE */
type = e_udev_find_by_type(EUDEV_TYPE_MOUSE, NULL);
EINA_LIST_FOREACH(type, l, name)
{ /* add the devpath to the hash for use in the cb later */
eina_hash_direct_add(hash, name, e_udev_syspath_get_devpath(name)); /* get a property using the device's syspath */
printf("Found mouse %s with vendor: %s\n", name, e_udev_syspath_get_property(name, "ID_VENDOR"));
}
/* we save this list for later, because once a device is unplugged it can
* no longer be detected by udev, and any related properties are unusable unless
* they have been previously stored
*/
akbdmouse->mice = type;
printf("\nNow let's try something a little more difficult. Mountable filesystems!\n");
/* find all mountable drives using type EUDEV_TYPE_DRIVE_MOUNTABLE */
type = e_udev_find_by_type(EUDEV_TYPE_DRIVE_MOUNTABLE, NULL);
EINA_LIST_FOREACH(type, l, name)
{
printf("Found device: %s\n", name); /* get a property using the device's syspath */
printf("\tYou probably know it better as %s\n", e_udev_syspath_get_property(name, "DEVNAME"));
printf("\tIt's formatted as %s", e_udev_syspath_get_property(name, "ID_FS_TYPE"));
check = e_udev_syspath_get_property(name, "FSTAB_DIR");
if (check)
printf(", and gets mounted at %s", check);
printf("!\n");
}
eina_list_free(type);
printf("\nInternal drives, anyone? With serial numbers?\n");
/* find all internal drives using type EUDEV_TYPE_DRIVE_INTERNAL */
type = e_udev_find_by_type(EUDEV_TYPE_DRIVE_INTERNAL, NULL);
EINA_LIST_FOREACH(type, l, name) /* get a property using the device's syspath */
printf("%s: %s\n", name, e_udev_syspath_get_property(name, "ID_SERIAL"));
eina_list_free(type);
printf("\nGot any removables? I'm gonna find em!\n");
/* find all removable media using type EUDEV_TYPE_DRIVE_REMOVABLE */
type = e_udev_find_by_type(EUDEV_TYPE_DRIVE_REMOVABLE, NULL);
EINA_LIST_FOREACH(type, l, name) /* get a property using the device's syspath */
printf("\tOoh, a %s attached on your %s bus!\n", e_udev_syspath_get_property(name, "ID_MODEL"),
e_udev_syspath_get_property(name, "ID_BUS"));
eina_list_free(type);
/* set a udev watch, grab all events because no EUDEV_TYPE filter is specified,
* set the events to be sent to callback function catch_events(), and attach
* kbdmouse to the watch as associated data
*/
e_udev_watch_add(EUDEV_TYPE_NONE, catch_events, akbdmouse);
printf("\nAnd now for something more complicated. Plug or unplug your keyboard or mouse for me.\n");
/* main loop must be started to use ecore fd polling */
ecore_main_loop_begin();
}

View File

@ -0,0 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS=udev

View File

@ -0,0 +1,137 @@
#ifndef E_UDEV_H
#define E_UDEV_H
#include <Ecore.h>
#include <libudev.h>
#ifdef EAPI
#undef EAPI
#endif
#ifdef _MSC_VER
#error "This will not run on windows!"
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
# else
# define EAPI
# endif
#endif
/**
* @defgroup Subsystem_Types Subsystem_Types
*
* ac97
* acpi
* bdi
* block
* bsg
* dmi
* graphics
* hid
* hwmon
* i2c
* input
* mem
* misc
* net
* pci
* pci_bus
* pci_express
* platform
* pnp
* rtc
* scsi
* scsi_device
* scsi_disk
* scsi_generic
* scsi_host
* serio
* sound
* thermal
* tty
* usb
* usb_device
* vc
* vtconsole
*
* @ingroup udev
*/
/**
* @defgroup Device_Types Device_Types
*
* atapi
* audio
* block
* cd
* char
* disk
* floppy
* generic
* hid
* hub
* media
* optical
* printer
* rbc
* scsi
* storage
* tape
* video
*
* @ingroup udev
*/
/*FIXME: these probably need to be bitmasks with categories*/
typedef enum
{
EUDEV_TYPE_NONE,
EUDEV_TYPE_KEYBOARD,
EUDEV_TYPE_MOUSE,
EUDEV_TYPE_TOUCHPAD,
EUDEV_TYPE_DRIVE_MOUNTABLE,
EUDEV_TYPE_DRIVE_INTERNAL,
EUDEV_TYPE_DRIVE_REMOVABLE,
EUDEV_TYPE_DRIVE_CDROM,
EUDEV_TYPE_POWER_AC,
EUDEV_TYPE_POWER_BAT
/* EUDEV_TYPE_ANDROID */
} Eudev_Type;
struct Eudev_Watch;
typedef struct Eudev_Watch Eudev_Watch;
#ifdef __cplusplus
extern "C" {
#endif
EAPI int e_udev_init(void);
EAPI int e_udev_shutdown(void);
EAPI Eina_List *e_udev_find_by_type(const Eudev_Type type, const char *name);
EAPI Eina_List *e_udev_find_by_filter(const char *subsystem, const char *type, const char *name);
EAPI const char *e_udev_syspath_rootdev_get(const char *syspath);
EAPI const char *e_udev_syspath_get_devpath(const char *syspath);
EAPI const char *e_udev_syspath_get_subsystem(const char *syspath);
EAPI const char *e_udev_syspath_get_property(const char *syspath, const char *property);
EAPI const char *e_udev_devpath_get_syspath(const char *devpath);
EAPI const char *e_udev_devpath_get_subsystem(const char *devpath);
EAPI Eina_Bool e_udev_syspath_is_mouse(const char *syspath);
EAPI Eina_Bool e_udev_syspath_is_kbd(const char *syspath);
EAPI Eina_Bool e_udev_syspath_is_touchpad(const char *syspath);
EAPI Eudev_Watch *e_udev_watch_add(Eudev_Type type, void(*func)(const char *, void *, Eudev_Watch *), void *user_data);
EAPI void *e_udev_watch_del(Eudev_Watch *watch);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,21 @@
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = @ECORE_CFLAGS@
if BUILD_EUDEV
lib_LTLIBRARIES = libeudev.la
include_HEADERS = E_Udev.h
noinst_HEADERS = e_udev_private.h
libeudev_la_SOURCES = \
E_Udev.h \
e_udev.c \
e_udev_watch.c \
e_udev_main.c
libeudev_la_LIBADD = @ECORE_LIBS@ @UDEV_LIBS@
libeudev_la_LDFLAGS = -no-undefined -version-info @version_info@ @eudev_release_info@
endif

View File

@ -0,0 +1,513 @@
#include <E_Udev.h>
#include "e_udev_private.h"
/**
* @defgroup udev udev
*
* These are functions which interact directly with udev.
*/
/**
* Find the root device of a device from its syspath.
*
* @param syspath The syspath of a device, with or without "/sys/"
* @return The syspath of the parent device
*
* Return a syspath (/sys/$syspath) for the parent device.
*
* @ingroup udev
*/
EAPI const char *
e_udev_syspath_rootdev_get(const char *syspath)
{
struct udev *udev;
struct udev_device *device, *parent;
const char *ret;
if (!syspath) return NULL;
udev = udev_new();
if (!udev) return NULL;
device = udev_device_new_from_syspath(udev, syspath);
parent = udev_device_get_parent(device);
ret = eina_stringshare_add(udev_device_get_property_value(parent, "DEVPATH"));
udev_device_unref(device);
udev_unref(udev);
return ret;
}
/**
* Find devices using a EUDEV_TYPE_* and/or a name.
*
* @param type A Eudev_Type or 0
* @param name A filter for the device name or NULL
* @return A Eina_List* of matched devices or NULL on failure
*
* Return a list of syspaths (/sys/$syspath) for matching udev devices.
*
* @ingroup udev
*/
EAPI Eina_List *
e_udev_find_by_type(const Eudev_Type etype, const char *name)
{
struct udev *udev;
struct udev_enumerate *en;
struct udev_list_entry *devs, *cur;
struct udev_device *device, *parent;
const char *sysname, *devname;
Eina_List *ret = NULL;
if (!etype && !name) return NULL;
udev = udev_new();
if (!udev) return NULL;
en = udev_enumerate_new(udev);
if (!en) return NULL;
switch (etype)
{
case EUDEV_TYPE_NONE:
break;
case EUDEV_TYPE_KEYBOARD:
udev_enumerate_add_match_subsystem(en, "input");
udev_enumerate_add_match_property(en, "ID_INPUT_KEYBOARD", "1");
break;
case EUDEV_TYPE_MOUSE:
udev_enumerate_add_match_subsystem(en, "input");
udev_enumerate_add_match_property(en, "ID_INPUT_MOUSE", "1");
break;
case EUDEV_TYPE_TOUCHPAD:
udev_enumerate_add_match_subsystem(en, "input");
udev_enumerate_add_match_property(en, "ID_INPUT_TOUCHPAD", "1");
break;
case EUDEV_TYPE_DRIVE_MOUNTABLE:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_FS_USAGE", "filesystem");
udev_enumerate_add_nomatch_sysattr(en, "capability", "52");
break;
case EUDEV_TYPE_DRIVE_INTERNAL:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_TYPE", "disk");
udev_enumerate_add_match_property(en, "ID_BUS", "ata");
udev_enumerate_add_match_sysattr(en, "removable", "0");
break;
case EUDEV_TYPE_DRIVE_REMOVABLE:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_TYPE", "disk");
udev_enumerate_add_match_sysattr(en, "removable", "1");
break;
case EUDEV_TYPE_DRIVE_CDROM:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_CDROM", "1");
break;
case EUDEV_TYPE_POWER_AC:
udev_enumerate_add_match_subsystem(en, "power_supply");
udev_enumerate_add_match_property(en, "POWER_SUPPLY_TYPE", "Mains");
break;
case EUDEV_TYPE_POWER_BAT:
udev_enumerate_add_match_subsystem(en, "power_supply");
udev_enumerate_add_match_property(en, "POWER_SUPPLY_TYPE", "Battery");
break;
/*
case EUDEV_TYPE_ANDROID:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_MODEL", "Android_*");
break;
*/
default:
break;
}
udev_enumerate_scan_devices(en);
devs = udev_enumerate_get_list_entry(en);
udev_list_entry_foreach(cur, devs)
{
devname = udev_list_entry_get_name(cur);
device = udev_device_new_from_syspath(udev, devname);
if (name)
if (!strstr(sysname,name))
goto out;
ret = eina_list_append(ret, eina_stringshare_add(udev_device_get_property_value(device, "DEVPATH")));
out:
udev_device_unref(device);
}
udev_enumerate_unref(en);
udev_unref(udev);
return ret;
}
/**
* A more advanced find, allows finds using udev properties.
*
* @param subsystem The udev subsystem to filter by, or NULL
* @param type "ID_INPUT_KEY", "ID_INPUT_MOUSE", "ID_INPUT_TOUCHPAD", NULL, etc
* @param name A filter for the device name, or NULL
* @return A Eina_List* of matched devices or NULL on failure
*
* Return a list of syspaths (/sys/$syspath) for matching udev devices.
* Requires at least one filter.
*
* @ingroup udev
*/
EAPI Eina_List *
e_udev_find_by_filter(const char *subsystem, const char *type, const char *name)
{
struct udev *udev;
struct udev_enumerate *en;
struct udev_list_entry *devs, *cur;
struct udev_device *device, *parent;
const char *sysname, *id_type, *devname;
Eina_List *ret = NULL;
if (!subsystem && !type && !name) return NULL;
udev = udev_new();
if (!udev) return NULL;
en = udev_enumerate_new(udev);
if (!en) return NULL;
if (subsystem)
udev_enumerate_add_match_subsystem(en, subsystem);
udev_enumerate_add_match_property(en, type, "1");
udev_enumerate_scan_devices(en);
devs = udev_enumerate_get_list_entry(en);
udev_list_entry_foreach(cur, devs)
{
devname = udev_list_entry_get_name(cur);
device = udev_device_new_from_syspath(udev, devname);
if (name)
if (!strstr(sysname,name))
goto out;
ret = eina_list_append(ret, eina_stringshare_add(udev_device_get_property_value(device, "DEVPATH")));
out:
udev_device_unref(device);
}
udev_enumerate_unref(en);
udev_unref(udev);
return ret;
}
/**
* Get the /dev/ path from the /sys/ path.
*
* @param syspath The /sys/ path with or without the /sys/
* @return A const char* with the /dev/ path or NULL on failure
*
* Takes /sys/$PATH and turns it into the corresponding "/dev/x/y".
*
* @ingroup udev
*/
EAPI const char *
e_udev_syspath_get_devpath(const char *syspath)
{
struct udev *udev;
struct udev_device *device;
const char *name;
Eina_Strbuf *sbuf;
if (!syspath) return NULL;
udev = udev_new();
if (!udev) return NULL;
sbuf = eina_strbuf_new();
if (!strstr(syspath, "/sys/"))
eina_strbuf_append(sbuf, "/sys/");
eina_strbuf_append(sbuf, syspath);
device = udev_device_new_from_syspath(udev, eina_strbuf_string_get(sbuf));
name = eina_stringshare_add(udev_device_get_property_value(device, "DEVNAME"));
udev_device_unref(device);
udev_unref(udev);
eina_strbuf_free(sbuf);
return name;
}
/**
* Get the subsystem of a device from the /sys/ path.
*
* @param syspath The /sys/ path with or without the /sys/
* @return A const char* with the subsystem of the device or NULL on failure
*
* Takes /sys/$PATH and returns the corresponding device subsystem,
* such as "input" for keyboards/mice.
*
* @ingroup udev
*/
EAPI const char *
e_udev_syspath_get_subsystem(const char *syspath)
{
struct udev *udev;
struct udev_device *device;
const char *subsystem;
Eina_Strbuf *sbuf;
if (!syspath) return NULL;
udev = udev_new();
if (!udev) return NULL;
sbuf = eina_strbuf_new();
if (!strstr(syspath, "/sys/"))
eina_strbuf_append(sbuf, "/sys/");
eina_strbuf_append(sbuf, syspath);
device = udev_device_new_from_syspath(udev, eina_strbuf_string_get(sbuf));
subsystem = eina_stringshare_add(udev_device_get_property_value(device, "SUBSYSTEM"));
udev_device_unref(device);
udev_unref(udev);
eina_strbuf_free(sbuf);
return subsystem;
}
/**
* Get the property value of a device from the /sys/ path.
*
* @param syspath The /sys/ path with or without the /sys/
* @param property The property to get; full list of these is a FIXME
* @return A const char* with the subsystem of the device or NULL on failure
*
* Takes /sys/$PATH and returns the corresponding device subsystem,
* such as "input" for keyboards/mice.
*
* @ingroup udev
*/
EAPI const char *
e_udev_syspath_get_property(const char *syspath, const char *property)
{
struct udev *udev;
struct udev_device *device;
const char *value;
Eina_Strbuf *sbuf;
if (!syspath) return NULL;
udev = udev_new();
if (!udev) return NULL;
sbuf = eina_strbuf_new();
if (!strstr(syspath, "/sys/"))
eina_strbuf_append(sbuf, "/sys/");
eina_strbuf_append(sbuf, syspath);
device = udev_device_new_from_syspath(udev, eina_strbuf_string_get(sbuf));
value = eina_stringshare_add(udev_device_get_property_value(device, property));
udev_device_unref(device);
udev_unref(udev);
eina_strbuf_free(sbuf);
return value;
}
/**
* Get the syspath of a device from the /dev/ path.
*
* @param devpath The /dev/ path of the device
* @return A const char* which corresponds to the /sys/ path of the device or NULL on failure
*
* Takes "/dev/path" and returns the corresponding /sys/ path (without the "/sys/")
*
* @ingroup udev
*/
EAPI const char *
e_udev_devpath_get_syspath(const char *devpath)
{
struct udev *udev;
struct udev_enumerate *en;
struct udev_list_entry *devs, *cur;
struct udev_device *device, *parent;
const char *name, *ret;
if (!devpath) return NULL;
udev = udev_new();
if (!udev) return NULL;
en = udev_enumerate_new(udev);
if (!en) return NULL;
udev_enumerate_add_match_property(en, "DEVNAME", devpath);
udev_enumerate_scan_devices(en);
devs = udev_enumerate_get_list_entry(en);
udev_list_entry_foreach(cur, devs)
{
name = udev_list_entry_get_name(cur);
device = udev_device_new_from_syspath(udev, name);
ret = eina_stringshare_add(udev_device_get_sysname(device));
udev_device_unref(device);
break; /*just in case there's more than one somehow*/
}
udev_enumerate_unref(en);
udev_unref(udev);
return ret;
}
/**
* Get the subsystem of a device from the /dev/ path.
*
* @param devpath The /dev/ path of the device
* @return A const char* with the subsystem of the device or NULL on failure
*
* Takes "/dev/path" and returns the subsystem of the device.
*
* @ingroup udev
*/
EAPI const char *
e_udev_devpath_get_subsystem(const char *devpath)
{
struct udev *udev;
struct udev_enumerate *en;
struct udev_list_entry *devs, *cur;
struct udev_device *device;
const char *name, *ret;
if (!devpath) return NULL;
udev = udev_new();
if (!udev) return NULL;
en = udev_enumerate_new(udev);
if (!en) return NULL;
udev_enumerate_add_match_property(en, "DEVNAME", devpath);
udev_enumerate_scan_devices(en);
devs = udev_enumerate_get_list_entry(en);
udev_list_entry_foreach(cur, devs)
{
name = udev_list_entry_get_name(cur);
device = udev_device_new_from_syspath(udev, name);
ret = eina_stringshare_add(udev_device_get_subsystem(device));
udev_device_unref(device);
break; /*just in case there's more than one somehow*/
}
udev_enumerate_unref(en);
udev_unref(udev);
return ret;
}
/**
* Checks whether the device is a mouse.
*
* @param syspath The /sys/ path of the device
* @return If true, the device is a mouse
*
* @ingroup udev
*/
EAPI Eina_Bool
e_udev_syspath_is_mouse(const char *syspath)
{
struct udev *udev;
struct udev_device *device;
Eina_Bool mouse = 0;
Eina_Strbuf *sbuf;
const char *test = NULL;
if (!syspath) return 0;
udev = udev_new();
if (!udev) return 0;
sbuf = eina_strbuf_new();
if (!strstr(syspath, "/sys/"))
eina_strbuf_append(sbuf, "/sys/");
eina_strbuf_append(sbuf, syspath);
device = udev_device_new_from_syspath(udev, eina_strbuf_string_get(sbuf));
test = udev_device_get_property_value(device, "ID_INPUT_MOUSE");
if (test) mouse = atoi(test);
udev_device_unref(device);
udev_unref(udev);
return mouse;
}
/**
* Checks whether the device is a keyboard.
*
* @param syspath The /sys/ path of the device
* @return If true, the device is a keyboard
*
* @ingroup udev
*/
EAPI Eina_Bool
e_udev_syspath_is_kbd(const char *syspath)
{
struct udev *udev;
struct udev_device *device;
Eina_Bool kbd = 0;
Eina_Strbuf *sbuf;
const char *test = NULL;
if (!syspath) return 0;
udev = udev_new();
if (!udev) return 0;
sbuf = eina_strbuf_new();
if (!strstr(syspath, "/sys/"))
eina_strbuf_append(sbuf, "/sys/");
eina_strbuf_append(sbuf, syspath);
device = udev_device_new_from_syspath(udev, eina_strbuf_string_get(sbuf));
test = udev_device_get_property_value(device, "ID_INPUT_KEYBOARD");
if (test) kbd = atoi(test);
udev_device_unref(device);
udev_unref(udev);
return kbd;
}
/**
* Checks whether the device is a touchpad.
*
* @param syspath The /sys/ path of the device
* @return If true, the device is a touchpad
*
* @ingroup udev
*/
EAPI Eina_Bool
e_udev_syspath_is_touchpad(const char *syspath)
{
struct udev *udev;
struct udev_device *device;
Eina_Bool touchpad = 0;
Eina_Strbuf *sbuf;
const char *test = NULL;
if (!syspath) return 0;
udev = udev_new();
if (!udev) return 0;
sbuf = eina_strbuf_new();
if (!strstr(syspath, "/sys/"))
eina_strbuf_append(sbuf, "/sys/");
eina_strbuf_append(sbuf, syspath);
device = udev_device_new_from_syspath(udev, eina_strbuf_string_get(sbuf));
test = udev_device_get_property_value(device, "ID_INPUT_TOUCHPAD");
if (test) touchpad = atoi(test);
udev_device_unref(device);
udev_unref(udev);
return touchpad;
}

View File

@ -0,0 +1,46 @@
#include <E_Udev.h>
#include "e_udev_private.h"
int _e_eeze_udev_log_dom = -1;
int _e_eeze_udev_init_count = 0;
EAPI int
e_udev_init(void)
{
if (++_e_eeze_udev_init_count != 1)
return _e_eeze_udev_init_count;
if (!eina_init())
return --_e_eeze_udev_init_count;
_e_eeze_udev_log_dom = eina_log_domain_register
("e_udev", E_EEZE_COLOR_DEFAULT);
if (_e_eeze_udev_log_dom < 0)
{
EINA_LOG_ERR("Could not register 'e_udev' log domain.");
goto shutdown_eina;
}
return _e_eeze_udev_init_count;
unregister_log_domain:
eina_log_domain_unregister(_e_eeze_udev_log_dom);
_e_eeze_udev_log_dom = -1;
shutdown_eina:
eina_shutdown();
return _e_eeze_udev_init_count;
}
EAPI int
e_udev_shutdown(void)
{
if (--_e_eeze_udev_init_count != 0)
return _e_eeze_udev_init_count;
eina_log_domain_unregister(_e_eeze_udev_log_dom);
_e_eeze_udev_log_dom = -1;
eina_shutdown();
return _e_eeze_udev_init_count;
}

View File

@ -0,0 +1,26 @@
#ifndef E_UDEV_PRIVATE_H
#define E_UDEV_PRIVATE_H
#ifndef E_EEZE_COLOR_DEFAULT
#define E_EEZE_COLOR_DEFAULT EINA_COLOR_CYAN
#endif
extern int _e_eeze_udev_log_dom;
#ifdef ERR
#undef ERR
#endif
#ifdef INF
#undef INF
#endif
#ifdef WARN
#undef WARN
#endif
#ifdef DBG
#undef DBG
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_e_eeze_udev_log_dom, __VA_ARGS__)
#define INFO(...) EINA_LOG_DOM_INFO(_e_eeze_udev_log_dom, __VA_ARGS__)
#define WARN(...) EINA_LOG_DOM_WARN(_e_eeze_udev_log_dom, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_e_eeze_udev_log_dom, __VA_ARGS__)
#endif

View File

@ -0,0 +1,228 @@
#include <E_Udev.h>
#include "e_udev_private.h"
/* opaque */
struct Eudev_Watch
{
struct udev_monitor *mon;
Ecore_Fd_Handler *handler;
Eudev_Type type;
};
/* private */
struct _store_data
{
void(*func)(const char *, void *, Eudev_Watch *);
void *data;
struct udev_monitor *mon;
Eudev_Type type;
Eudev_Watch *watch;
};
/* private function to further filter watch results based on Eudev_Type
* specified
*/
static int
_get_syspath_from_watch(void *data, Ecore_Fd_Handler *fd_handler)
{
struct _store_data *store = data;
struct udev_device *device;
const char *ret, *test;
void(*func)(const char *, void *, Eudev_Watch *) = store->func;
void *sdata = store->data;
Eudev_Watch *watch = store->watch;
int cap = 0;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
return 0;
device = udev_monitor_receive_device(store->mon);
if (!device) return 0;
switch (store->type)
{
case EUDEV_TYPE_KEYBOARD:
if (!udev_device_get_property_value(device, "ID_INPUT_KEYBOARD"))
goto error;
break;
case EUDEV_TYPE_MOUSE:
if (!udev_device_get_property_value(device, "ID_INPUT_MOUSE"))
goto error;
break;
case EUDEV_TYPE_TOUCHPAD:
if (!udev_device_get_property_value(device, "ID_INPUT_TOUCHPAD"))
goto error;
break;
case EUDEV_TYPE_DRIVE_MOUNTABLE:
test = udev_device_get_sysattr_value(device, "capability");
if (test) cap = atoi(test);
if (!(test = (udev_device_get_property_value(device, "ID_FS_USAGE"))) ||
strcmp("filesystem", test) || cap == 52)
goto error;
break;
case EUDEV_TYPE_DRIVE_INTERNAL:
if (!(test = udev_device_get_property_value(device, "ID_BUS")) || strcmp("ata", test) ||
!(test = udev_device_get_sysattr_value(device, "removable")) || atoi(test))
goto error;
break;
case EUDEV_TYPE_DRIVE_REMOVABLE:
if ((!(test = udev_device_get_sysattr_value(device, "removable")) || !atoi(test)) &&
(!(test = udev_device_get_sysattr_value(device, "capability")) || atoi(test) != 10))
goto error;
break;
case EUDEV_TYPE_DRIVE_CDROM:
if (!udev_device_get_property_value(device, "ID_CDROM"))
goto error;
break;
case EUDEV_TYPE_POWER_AC:
if (!(test = (udev_device_get_property_value(device, "POWER_SUPPLY_TYPE"))) ||
strcmp("Mains", test))
break;
case EUDEV_TYPE_POWER_BAT:
if (!(test = (udev_device_get_property_value(device, "POWER_SUPPLY_TYPE"))) ||
strcmp("Battery", test))
break;
/*
case EUDEV_TYPE_ANDROID:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
break;
*/
default:
break;
}
ret = eina_stringshare_add(udev_device_get_syspath(device));
if (!ret) return 0;
udev_device_unref(device);
(*func)(ret, sdata, watch);
return 1;
error:
udev_device_unref(device);
return 0;
}
/**
* Add a watch in a subsystem for a device type
*
* @param subsystem The subsystem type. See @ref Subsystem_Types
* @param device_type The device type. See @ref Device_Types
* @param func The function to call when the watch receives data
* @param user_data Data to pass to the callback function
*
* @return A watch struct for the watch type specified, or NULL on failure
*
* @ingroup udev
*/
EAPI Eudev_Watch *
e_udev_watch_add(Eudev_Type type, void(*func)(const char *, void *, Eudev_Watch *), void *user_data)
{
struct udev *udev;
struct udev_monitor *mon;
int fd;
Ecore_Fd_Handler *handler;
Eudev_Watch *watch;
struct _store_data *store;
const char *subsystem, *device_type;
if (!(store = malloc(sizeof(struct _store_data)))) return NULL;
if (!(watch = malloc(sizeof(Eudev_Watch))))
goto error;
if (!(udev = udev_new()))
goto error;
if (!(mon = udev_monitor_new_from_netlink(udev, "udev")))
goto error;
switch (type)
{
case EUDEV_TYPE_KEYBOARD:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
break;
case EUDEV_TYPE_MOUSE:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
break;
case EUDEV_TYPE_TOUCHPAD:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
break;
case EUDEV_TYPE_DRIVE_MOUNTABLE:
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
break;
case EUDEV_TYPE_DRIVE_INTERNAL:
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
break;
case EUDEV_TYPE_DRIVE_REMOVABLE:
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
break;
case EUDEV_TYPE_DRIVE_CDROM:
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
break;
case EUDEV_TYPE_POWER_AC:
udev_monitor_filter_add_match_subsystem_devtype(mon, "power_supply", "*");
break;
case EUDEV_TYPE_POWER_BAT:
udev_monitor_filter_add_match_subsystem_devtype(mon, "power_supply", "*");
break;
/*
case EUDEV_TYPE_ANDROID:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
break;
*/
default:
break;
}
if (udev_monitor_enable_receiving(mon))
goto error;
fd = udev_monitor_get_fd(mon);
store->func = func;
store->data = user_data;
store->mon = mon;
store->type = type;
store->watch = watch;
if (!(handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _get_syspath_from_watch, store, NULL, NULL)))
goto error;
watch->mon = mon;
watch->handler = handler;
return watch;
error:
free(store);
free(watch);
udev_monitor_unref(mon);
udev_unref(udev);
return NULL;
}
/**
* Deletes a watch.
*
* @param watch An Eudev_Watch object
* @return The data originally associated with the watch, or NULL
*
* Deletes a watch, closing file descriptors and freeing related udev memory.
*
* @ingroup udev
*/
EAPI void *
e_udev_watch_del(Eudev_Watch *watch)
{
struct udev *udev;
struct udev_monitor *mon = watch->mon;
Ecore_Fd_Handler *handler = watch->handler;
struct _store_data *sdata;
void *ret;
if (!watch || !mon || !handler) return NULL;
udev = udev_monitor_get_udev(mon);
udev_monitor_unref(mon);
udev_unref(udev);
sdata = ecore_main_fd_handler_del(handler);
ret = sdata->data;
free(sdata);
free(watch);
return ret;
}