mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-15 14:14:13 +00:00
synapticsmst: Improve error reporting
Rather then always assuming open() fails because of permission denied, generate the GError code from the errno and add the related strerror to the message. And ofcourse output the error message in debugging rather then just ignoring it. Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
This commit is contained in:
parent
0a4409f231
commit
2bc6d0a38a
@ -259,7 +259,7 @@ fu_plugin_synapticsmst_enumerate (FuPlugin *plugin,
|
||||
|
||||
/* If we open succesfully a device exists here */
|
||||
device = synapticsmst_device_new (SYNAPTICSMST_DEVICE_KIND_DIRECT, aux_node, 0, 0);
|
||||
if (!synapticsmst_device_open (device, NULL)) {
|
||||
if (!synapticsmst_device_open (device, &error_local)) {
|
||||
/* No device exists here, but was there - remove from DB */
|
||||
if (fu_dev != NULL) {
|
||||
g_debug ("Removing devices on %s", aux_node);
|
||||
@ -269,7 +269,8 @@ fu_plugin_synapticsmst_enumerate (FuPlugin *plugin,
|
||||
aux_node);
|
||||
} else {
|
||||
/* Nothing to see here - move on*/
|
||||
g_debug ("No device found on %s", aux_node);
|
||||
g_debug ("No device found on %s: %s", aux_node, error_local->message);
|
||||
g_clear_error (&error_local);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <glib-object.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
@ -174,9 +175,9 @@ synapticsmst_device_enable_remote_control (SynapticsMSTDevice *device, GError **
|
||||
if (priv->fd == -1) {
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_PERMISSION_DENIED,
|
||||
"cannot open device %s",
|
||||
filename);
|
||||
g_io_error_from_errno (errno),
|
||||
"cannot open device %s: %s",
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -786,9 +787,9 @@ synapticsmst_device_open (SynapticsMSTDevice *device, GError **error)
|
||||
if (priv->fd == -1) {
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_PERMISSION_DENIED,
|
||||
"cannot open device %s",
|
||||
filename);
|
||||
g_io_error_from_errno (errno),
|
||||
"cannot open device %s: %s",
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user