LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2008, 08:55 PM   #1
chenja
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Rep: Reputation: 0
usb_set_configuration() failed from non-root user


I created a DS2490 driver in user space by using lusb(kernel 2.6.x) with RedHat R5, but it can only run from “root”. The function usbsetconfiguration() always fails from non-root user. Do we have to call usb_set_configuration() before other transaction? It is in libusb, why it can not be called from non-root user? Is there anyway to get around? Can anyone please help?
Thanks.

Last edited by chenja; 02-17-2008 at 07:25 PM.
 
Old 02-18-2008, 08:11 AM   #2
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Did you tried chown?

Last edited by alan_ri; 02-18-2008 at 08:12 AM.
 
Old 02-19-2008, 08:35 AM   #3
chenja
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by alan_ri View Post
Did you tried chown?
Thanks for your replying. My application is calling ds2490.so created in lunix redhat 5. If I run my application from "root", everything is ok. But I got following errors from "non-root" user when I turn on "usb_debug". So I have tried some combinations with root, my_group and my_user by using chown command:
chown root:root ds2490.so
chown my_user:my_group ds2490.so
...
But they didn't fix the problem, any further comments? (see the errors and code below)

Thanks.


DS2490 found on Bus002 Dev002
usb_handle = 0x84cdbc8
USB error: could not set config 1: Operation not permitted
usb_set_configuration(1) returns -1
USB error: could not get bound driver: Operation not permitted
USB error: could not detach kernel driver from interface 0: Operation not permitted
USB error: could not set config 1: Operation not permitted
Failed to set configuration on USB DS9490 adapter[/SIZE][/COLOR]

;here is part of my program
...
usb_dev = device_init();
if (usb_dev == 0) {
printf("DS2490 not found\n");
usb_close(usb_handle);
return -1;
}

usb_handle = usb_open(usb_dev);

if (usb_handle == 0){
printf("Not able to open the USB device\n");
usb_close(usb_handle);
return -1;
}
if(dongleDebug)
printf("usb_handle = 0x%x\n",usb_handle);
ret =usb_set_configuration(usb_handle, 1);
printf("usb_set_configuration(1) returns %d\n",ret);
if (ret<0){
char drvnm[128];
drvnm[0]=0;
usb_get_driver_np(usb_handle, 0, drvnm, sizeofsu chenj(drvnm)-1);
usb_detach_kernel_driver_np(usb_handle,0);
if (usb_set_configuration(usb_handle, 1)<0){
printf("Failed to set configuration on USB DS9490 adapter\n");
usb_close(usb_handle);
return -1;
}
}

ret = usb_claim_interface(usb_handle, 0);
printf("usb_claim_interface() returns %d\n",ret);
if (ret<0){
printf("Failed to claim interface on USB DS9490 adapter\n");
usb_close(usb_handle);
return -1;
}
ret = usb_set_altinterface(usb_handle, 3);
printf("usb_set_altinterface() returns %d\n",ret);
if (ret<0){
printf ("Failed to set alt interface on USB DS9490 adapter\n");
usb_close(usb_handle);
return -1;
}
 
Old 02-19-2008, 09:30 AM   #4
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Try this: cd as root to the directory where file is,then use this syntax: chown -R newowner filename.We will see if that helps.

Last edited by alan_ri; 02-19-2008 at 09:31 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
New user failed to login using GUI, But for root it is working kcarun Solaris / OpenSolaris 8 07-29-2007 03:07 AM
why lftp command run failed when user isn't root, but ok when logining as root steven_yu Linux - Software 0 06-06-2007 08:36 PM
Failed Attempt to Compile 2.6.5 as Non-root User farmerdan Linux - General 3 04-06-2004 06:49 PM
Authentication failed Starting X for any User but root aimstr8 Linux - Software 4 02-27-2004 12:54 PM
root and user password failed sarah_777 Linux - General 1 04-29-2002 10:46 PM


All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration