modified: source/inlprog.c
-moving returnvalue "rv" declaration/init earlier to ensure initization. -adding notes to user if LIBUSB_ERROR_ACCESS as it's expected on linux. modified: udev-rule-help/Readme.txt -including expected libusb error if user doesn't have access.
This commit is contained in:
parent
b1e60a35df
commit
37c79429ea
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
//context set to NULL since only acting as single user of libusb
|
||||
libusb_context *context = NULL;
|
||||
|
|
@ -70,7 +71,6 @@ int main(int argc, char *argv[])
|
|||
ssize_t dev_count = libusb_get_device_list( context, &device_list);
|
||||
check( dev_count >= 0, "libusb unable to find any devices: %s", libusb_strerror(dev_count));
|
||||
|
||||
int rv = 0;
|
||||
ssize_t i = 0;
|
||||
|
||||
libusb_device *retroprog = NULL;
|
||||
|
|
@ -242,12 +242,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
printf("program went to error\n");
|
||||
|
||||
//must close device before exiting
|
||||
// libusb_close(handle);
|
||||
|
||||
if (device_list) {
|
||||
printf("freeing device list\n");
|
||||
libusb_free_device_list( device_list, 1);
|
||||
|
|
@ -259,11 +257,16 @@ error:
|
|||
}
|
||||
|
||||
if (usb_init == LIBUSB_SUCCESS) {
|
||||
//deinitialize libusb to be called after closing all devices and before teminating application
|
||||
printf("exiting libusb\n");
|
||||
printf("deinitializing libusb\n");
|
||||
libusb_exit(context);
|
||||
}
|
||||
|
||||
if (rv == LIBUSB_ERROR_ACCESS) {
|
||||
printf("-------------------------------------------------------\n");
|
||||
printf("Denied Permission is expected for initial use on Linux.\n");
|
||||
printf("See udev-rule-help/Readme.txt in host dir for help gaining permission.\n");
|
||||
printf("Try command with sudo for a cheap temporary solution.\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
|
||||
You'll probably have issues where the host app can't detect the device.
|
||||
You'll probably have issues where the host app can't detect the device with linux systems.
|
||||
|
||||
If you don't have permission to write to the device you'll get an error message such as:
|
||||
libusbx: error [_get_usbfs_fd] libusbx couldn't open USB device /dev/bus/usb/002/021: Permission denied
|
||||
libusbx: error [_get_usbfs_fd] libusbx requires write access to USB device nodes.
|
||||
[ERROR] (source/inlprog.c:99: errno: Permission denied) Unable to open USB device: Access denied (insufficient permissions)
|
||||
|
||||
This can be temporarily corrected by running as sudo
|
||||
But you'll want to update permissions so don't need to run as sudo
|
||||
need to create udev rule to give user permissions to device when inserted.
|
||||
|
|
@ -23,7 +29,7 @@ Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
|
|||
The "Van Ooijen..." device is the INL-retroprog as noted with 16c0:05dc Vendor:Prod ID
|
||||
you can check current permissions by checking /dev/ location
|
||||
use the Bus number and Device number to check permissions on the INL retro-prog
|
||||
I'm not sure if all unix systems place usb devices in this location..
|
||||
the initial error should point out the /dev/ location of the device
|
||||
In my example:
|
||||
paul@eeepc:~$ ls -ltr /dev/bus/usb/002/021
|
||||
crw-rw-r-- 1 root root 189, 148 Nov 18 01:36 /dev/bus/usb/002/021
|
||||
|
|
|
|||
Loading…
Reference in New Issue