-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improved error message request for usb.c #585
Comments
Please use a Pull Request to submit contributions. Thanks!
…Sent from my Nokia 3210
On 10 Apr 2017, at 23:11, Peter Torelli ***@***.***> wrote:
Ubuntu 16.10 requires root access to open a device. I often forget this since I routinely switch between macOS, Windows and Linux. This is a bit pedantic, but the WLOG messages in src/usb.c aren't succinct enough or are incorrect. I changed them to the following as a user-experience improvement, but I don't have branch permissions:
diff --git a/src/usb.c b/src/usb.c
index 03ac1ab..33bb350 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -959,7 +959,7 @@ static size_t stlink_probe_usb_devs(libusb_device **devs, stlink_t **sldevs[]) {
struct libusb_device_descriptor desc;
int r = libusb_get_device_descriptor(dev, &desc);
if (r < 0) {
- WLOG("failed to get libusb device descriptor\n");
+ WLOG("failed to get libusb device descriptor during count (libusb error: %d)\n", ret);
break;
}
@@ -983,7 +983,7 @@ static size_t stlink_probe_usb_devs(libusb_device **devs, stlink_t **sldevs[]) {
struct libusb_device_descriptor desc;
ret = libusb_get_device_descriptor(dev, &desc);
if (ret < 0) {
- WLOG("failed to get libusb device descriptor\n");
+ WLOG("failed to get libusb device descriptor during open (libusb error: %d)\n", ret);
break;
}
@@ -997,7 +997,10 @@ static size_t stlink_probe_usb_devs(libusb_device **devs, stlink_t **sldevs[]) {
ret = libusb_open(dev, &handle);
if (ret < 0) {
- WLOG("failed to get libusb device descriptor\n");
+ if (ret == LIBUSB_ERROR_ACCESS)
+ WLOG("failed to open USB device (LIBUSB_ERROR_ACCESS), try running as root?\n");
+ else
+ WLOG("failed to open USB device (libusb error: %d)\n", ret);
break;
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@xor-gate I'd love to but I don't have permissions to make a branch to make a pull request. :) |
Hi @petertorelli, Probably you are not used to Git workflow -> Fork repo (github) -> Create feature Branch -> Create Pull request to upstream -> Merge. You should read some documentation, because I only accept PRs. https://help.github.com/articles/creating-a-pull-request-from-a-fork/ Thank you, |
Ping @petertorelli, probably the message should not be that you running as root but having insufficient permissions to access the device. Please submit a PR if you want this in master. |
@petertorelli: Please submit this proposal in form of a PR so that it can be properly addressed. |
Ubuntu 16.10 requires root access to open a device. I often forget this since I routinely switch between macOS, Windows and Linux. This is a bit pedantic, but the WLOG messages in src/usb.c aren't succinct enough or are incorrect. I changed them to the following as a user-experience improvement, but I don't have branch permissions:
The text was updated successfully, but these errors were encountered: