Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
libfprint
fprintd
Commits
5426b1a4
Commit
5426b1a4
authored
Nov 20, 2008
by
Bastien Nocera
Committed by
Daniel Drake
Nov 21, 2008
Browse files
Use GetDefaultDevice
As we're not using the non-default device anyway.
parent
e207203b
Changes
3
Hide whitespace changes
Inline
Side-by-side
pam/pam_fprintd.c
View file @
5426b1a4
...
...
@@ -187,25 +187,22 @@ static DBusGProxy *create_manager (DBusGConnection **ret_conn, GMainLoop **ret_l
static
DBusGProxy
*
open_device
(
DBusGConnection
*
connection
,
DBusGProxy
*
manager
,
const
char
*
username
)
{
GError
*
error
=
NULL
;
GPtrArray
*
devices
;
gchar
*
path
;
DBusGProxy
*
dev
;
if
(
!
dbus_g_proxy_call
(
manager
,
"GetDevice
s
"
,
&
error
,
G_TYPE_INVALID
,
dbus_g_type_get_collection
(
"GPtrArray"
,
DBUS_TYPE_G_OBJECT_PATH
)
,
&
devices
,
G_TYPE_INVALID
))
{
D
(
g_message
(
"
lis
t_devices failed: %s"
,
error
->
message
));
if
(
!
dbus_g_proxy_call
(
manager
,
"GetDe
faultDe
vice"
,
&
error
,
G_TYPE_INVALID
,
DBUS_TYPE_G_OBJECT_PATH
,
&
path
,
G_TYPE_INVALID
))
{
D
(
g_message
(
"
get_defaul
t_devices failed: %s"
,
error
->
message
));
g_error_free
(
error
);
return
NULL
;
}
if
(
devices
->
len
==
0
)
{
if
(
path
==
NULL
)
{
D
(
g_message
(
"No devices found
\n
"
));
return
NULL
;
}
D
(
g_message
(
"found %d devices
\n
"
,
devices
->
len
));
path
=
g_ptr_array_index
(
devices
,
0
);
D
(
g_message
(
"Using device %s
\n
"
,
path
));
dev
=
dbus_g_proxy_new_for_name
(
connection
,
...
...
@@ -213,8 +210,7 @@ static DBusGProxy *open_device(DBusGConnection *connection, DBusGProxy *manager,
path
,
"net.reactivated.Fprint.Device"
);
g_ptr_array_foreach
(
devices
,
(
GFunc
)
g_free
,
NULL
);
g_ptr_array_free
(
devices
,
TRUE
);
g_free
(
path
);
if
(
!
dbus_g_proxy_call
(
dev
,
"Claim"
,
&
error
,
G_TYPE_STRING
,
username
,
G_TYPE_INVALID
,
G_TYPE_INVALID
))
{
D
(
g_message
(
"failed to claim device: %s
\n
"
,
error
->
message
));
...
...
tests/enroll.c
View file @
5426b1a4
...
...
@@ -73,34 +73,24 @@ static void create_manager(void)
static
DBusGProxy
*
open_device
(
const
char
*
username
)
{
GError
*
error
=
NULL
;
GPtrArray
*
devices
;
gchar
*
path
;
DBusGProxy
*
dev
;
guint
i
;
if
(
!
net_reactivated_Fprint_Manager_get_device
s
(
manager
,
&
devices
,
&
error
))
if
(
!
net_reactivated_Fprint_Manager_get_
default_
device
(
manager
,
&
path
,
&
error
))
g_error
(
"list_devices failed: %s"
,
error
->
message
);
if
(
devices
->
len
==
0
)
{
if
(
path
==
NULL
)
{
g_print
(
"No devices found
\n
"
);
exit
(
1
);
}
g_print
(
"found %d devices
\n
"
,
devices
->
len
);
for
(
i
=
0
;
i
<
devices
->
len
;
i
++
)
{
path
=
g_ptr_array_index
(
devices
,
i
);
g_print
(
"Device at %s
\n
"
,
path
);
}
path
=
g_ptr_array_index
(
devices
,
0
);
g_print
(
"Using device %s
\n
"
,
path
);
/* FIXME use for_name_owner?? */
dev
=
dbus_g_proxy_new_for_name
(
connection
,
"net.reactivated.Fprint"
,
path
,
"net.reactivated.Fprint.Device"
);
g_ptr_array_foreach
(
devices
,
(
GFunc
)
g_free
,
NULL
);
g_ptr_array_free
(
devices
,
TRUE
);
g_free
(
path
);
if
(
!
net_reactivated_Fprint_Device_claim
(
dev
,
username
,
&
error
))
g_error
(
"failed to claim device: %s"
,
error
->
message
);
...
...
tests/verify.c
View file @
5426b1a4
...
...
@@ -75,34 +75,24 @@ static void create_manager(void)
static
DBusGProxy
*
open_device
(
const
char
*
username
)
{
GError
*
error
=
NULL
;
GPtrArray
*
devices
;
gchar
*
path
;
DBusGProxy
*
dev
;
guint
i
;
if
(
!
net_reactivated_Fprint_Manager_get_device
s
(
manager
,
&
devices
,
&
error
))
if
(
!
net_reactivated_Fprint_Manager_get_
default_
device
(
manager
,
&
path
,
&
error
))
g_error
(
"list_devices failed: %s"
,
error
->
message
);
if
(
devices
->
len
==
0
)
{
if
(
path
==
NULL
)
{
g_print
(
"No devices found
\n
"
);
exit
(
1
);
}
g_print
(
"found %d devices
\n
"
,
devices
->
len
);
for
(
i
=
0
;
i
<
devices
->
len
;
i
++
)
{
path
=
g_ptr_array_index
(
devices
,
i
);
g_print
(
"Device at %s
\n
"
,
path
);
}
path
=
g_ptr_array_index
(
devices
,
0
);
g_print
(
"Using device %s
\n
"
,
path
);
/* FIXME use for_name_owner?? */
dev
=
dbus_g_proxy_new_for_name
(
connection
,
"net.reactivated.Fprint"
,
path
,
"net.reactivated.Fprint.Device"
);
g_ptr_array_foreach
(
devices
,
(
GFunc
)
g_free
,
NULL
);
g_ptr_array_free
(
devices
,
TRUE
);
g_free
(
path
);
if
(
!
net_reactivated_Fprint_Device_claim
(
dev
,
username
,
&
error
))
g_error
(
"failed to claim device: %s"
,
error
->
message
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment