Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
Synopsis: [newusb] usbconfig(8) fails with misleading error when run as a normal user State-Changed-From-To: open-closed State-Changed-By: brucec State-Changed-When: Sun Mar 29 00:24:34 UTC 2009 State-Changed-Why: Fixed in -current. http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
On Tue, Jan 6, 2009 at 10:32 AM, Hans Petter Selasky hsela...@c2i.net wrote: On Saturday 03 January 2009, Volker wrote: On 01/03/09 01:35, Hans Petter Selasky wrote: On Wednesday 31 December 2008, v...@freebsd.org wrote: Synopsis: [newusb] usbconfig(8) fails with misleading error when run as a normal user Responsible-Changed-From-To: freebsd-bugs-freebsd-usb Responsible-Changed-By: vwe Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 Responsible-Changed-Why: reassign http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 Hi, usbconfig will only show USB devices which the user has access to. What should be the correct display message when no devices are accessible due to innsufficient permissions? --HPS Hans, what about access denied or insufficient privileges? Someone might have a better idea but everything should be better than silently refusing to do anything. Volker Is this Ok: http://perforce.freebsd.org/chv.cgi?CH=155731 --HPS Eh? I still think that strerror or something along those lines would be more helpful. You could also do if (getuid() != 0) { errx(1, Cluebat -- you might not be able to read the usb devices if you're not root); } or... struct stat usb_s; int fd = open(..., O_RDONLY /* blah, blah... */); if (fd == -1) { errx(1, Does the file -- %s -- exist?, file); } if (fstat(fd, usb_s) == -1) { errx(1, Couldn't stat the file: %s, file); } if (!S_IRUSR(usb_s.st_mode) !S_IRGRP(usb_s.st_mode) !S_IROTH(usb_s.st_mode)) { errx(1, File not readable (do you have read permissions?)); } /* Continue on merry way reading devices; maybe use strerror(3) for more intuitive error messages? */ Thoughts? -Garrett ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
On Tuesday 06 January 2009, Garrett Cooper wrote: On Tue, Jan 6, 2009 at 10:32 AM, Hans Petter Selasky hsela...@c2i.net wrote: On Saturday 03 January 2009, Volker wrote: On 01/03/09 01:35, Hans Petter Selasky wrote: On Wednesday 31 December 2008, v...@freebsd.org wrote: Synopsis: [newusb] usbconfig(8) fails with misleading error when run as a normal user Responsible-Changed-From-To: freebsd-bugs-freebsd-usb Responsible-Changed-By: vwe Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 Responsible-Changed-Why: reassign http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 Hi, usbconfig will only show USB devices which the user has access to. What should be the correct display message when no devices are accessible due to innsufficient permissions? --HPS Hans, what about access denied or insufficient privileges? Someone might have a better idea but everything should be better than silently refusing to do anything. Volker Is this Ok: http://perforce.freebsd.org/chv.cgi?CH=155731 --HPS Eh? I still think that strerror or something along those lines would be more helpful. Hi, If errno != 0, I could print out the current value like a string. You could also do if (getuid() != 0) { errx(1, Cluebat -- you might not be able to read the usb devices if you're not root); } Yes, but you are allowed to give non-root users access to USB aswell. So that would also be misleading. Would something like counting the number of devices you don't have access to be Ok? usbconfig ugenX.Y There are xxx USB devices not listed which require root access. or... struct stat usb_s; int fd = open(..., O_RDONLY /* blah, blah... */); if (fd == -1) { errx(1, Does the file -- %s -- exist?, file); } if (fstat(fd, usb_s) == -1) { errx(1, Couldn't stat the file: %s, file); } if (!S_IRUSR(usb_s.st_mode) !S_IRGRP(usb_s.st_mode) !S_IROTH(usb_s.st_mode)) { errx(1, File not readable (do you have read permissions?)); } /* Continue on merry way reading devices; maybe use strerror(3) for more intuitive error messages? */ Thoughts? It has to fit into libusb20 ... That's all. --HPS ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
In message: 7d6fde3d0901061110r79333a07jf4eb134224a94...@mail.gmail.com Garrett Cooper yanef...@gmail.com writes: : On Tue, Jan 6, 2009 at 10:32 AM, Hans Petter Selasky hsela...@c2i.net wrote: : On Saturday 03 January 2009, Volker wrote: : On 01/03/09 01:35, Hans Petter Selasky wrote: : On Wednesday 31 December 2008, v...@freebsd.org wrote: : Synopsis: [newusb] usbconfig(8) fails with misleading error when run as : a normal user : : Responsible-Changed-From-To: freebsd-bugs-freebsd-usb : Responsible-Changed-By: vwe : Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 : Responsible-Changed-Why: : reassign : : http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 : : Hi, : : usbconfig will only show USB devices which the user has access to. : : What should be the correct display message when no devices are accessible : due to innsufficient permissions? : : --HPS : : Hans, : : what about access denied or insufficient privileges? : : Someone might have a better idea but everything should be better than : silently refusing to do anything. : : Volker : : Is this Ok: : : http://perforce.freebsd.org/chv.cgi?CH=155731 : : --HPS : : Eh? I still think that strerror or something along those lines would : be more helpful. : : You could also do : : if (getuid() != 0) { : errx(1, Cluebat -- you might not be able to read the usb devices : if you're not root); : } : : or... : : struct stat usb_s; : : int fd = open(..., O_RDONLY /* blah, blah... */); : : if (fd == -1) { : errx(1, Does the file -- %s -- exist?, file); : } : : if (fstat(fd, usb_s) == -1) { : errx(1, Couldn't stat the file: %s, file); : } : : if (!S_IRUSR(usb_s.st_mode) !S_IRGRP(usb_s.st_mode) : !S_IROTH(usb_s.st_mode)) { : errx(1, File not readable (do you have read permissions?)); : } : : /* Continue on merry way reading devices; maybe use strerror(3) for : more intuitive error messages? */ : : Thoughts? Do you really have to be root to find the devices, if so, that's bad. Very bad. xsane refuses to run as root. I have: [localrules=10] add path 'uscanner*' mode 0660 to make it work. /dev/usb* in old usb allow listing w/o privs... Warner ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
On Tue, Jan 6, 2009 at 11:15 AM, M. Warner Losh i...@bsdimp.com wrote: In message: 7d6fde3d0901061110r79333a07jf4eb134224a94...@mail.gmail.com Garrett Cooper yanef...@gmail.com writes: : On Tue, Jan 6, 2009 at 10:32 AM, Hans Petter Selasky hsela...@c2i.net wrote: : On Saturday 03 January 2009, Volker wrote: : On 01/03/09 01:35, Hans Petter Selasky wrote: : On Wednesday 31 December 2008, v...@freebsd.org wrote: : Synopsis: [newusb] usbconfig(8) fails with misleading error when run as : a normal user : : Responsible-Changed-From-To: freebsd-bugs-freebsd-usb : Responsible-Changed-By: vwe : Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 : Responsible-Changed-Why: : reassign : : http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 : : Hi, : : usbconfig will only show USB devices which the user has access to. : : What should be the correct display message when no devices are accessible : due to innsufficient permissions? : : --HPS : : Hans, : : what about access denied or insufficient privileges? : : Someone might have a better idea but everything should be better than : silently refusing to do anything. : : Volker : : Is this Ok: : : http://perforce.freebsd.org/chv.cgi?CH=155731 : : --HPS : : Eh? I still think that strerror or something along those lines would : be more helpful. : : You could also do : : if (getuid() != 0) { : errx(1, Cluebat -- you might not be able to read the usb devices : if you're not root); : } : : or... : : struct stat usb_s; : : int fd = open(..., O_RDONLY /* blah, blah... */); : : if (fd == -1) { : errx(1, Does the file -- %s -- exist?, file); : } : : if (fstat(fd, usb_s) == -1) { : errx(1, Couldn't stat the file: %s, file); : } : : if (!S_IRUSR(usb_s.st_mode) !S_IRGRP(usb_s.st_mode) : !S_IROTH(usb_s.st_mode)) { : errx(1, File not readable (do you have read permissions?)); : } : : /* Continue on merry way reading devices; maybe use strerror(3) for : more intuitive error messages? */ : : Thoughts? Do you really have to be root to find the devices, if so, that's bad. Very bad. xsane refuses to run as root. I have: [localrules=10] add path 'uscanner*' mode 0660 to make it work. /dev/usb* in old usb allow listing w/o privs... Warner Hence that's why I provided another hacked solution. I hate `can't run this app unless root' because it doesn't accurately solve the problem, but it makes the issue more straightforward than `no devices' :). Personally I think using errno and strerror when trying to open / read devices would be a lot cleaner. Let me see what I can quickly grok from libusb(3) either tonight or tomorrow that might be an improvement.. -Garrett ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
In message: 200901062103.28124.hsela...@c2i.net Hans Petter Selasky hsela...@c2i.net writes: : On Tuesday 06 January 2009, M. Warner Losh wrote: : In message: 200901062024.31100.hsela...@c2i.net : : Hans Petter Selasky hsela...@c2i.net writes: : : On Tuesday 06 January 2009, M. Warner Losh wrote: : : In message: : : 7d6fde3d0901061110r79333a07jf4eb134224a94...@mail.gmail.com : : : : Garrett Cooper yanef...@gmail.com writes: : : : On Tue, Jan 6, 2009 at 10:32 AM, Hans Petter Selasky : : : hsela...@c2i.net : : : : wrote: : : : On Saturday 03 January 2009, Volker wrote: : : : On 01/03/09 01:35, Hans Petter Selasky wrote: : : : On Wednesday 31 December 2008, v...@freebsd.org wrote: : : : Synopsis: [newusb] usbconfig(8) fails with misleading error : : : when run as a normal user : : : : : : Responsible-Changed-From-To: freebsd-bugs-freebsd-usb : : : Responsible-Changed-By: vwe : : : Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 : : : Responsible-Changed-Why: : : : reassign : : : : : : http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 : : : : : : Hi, : : : : : : usbconfig will only show USB devices which the user has access : : : to. : : : : : : What should be the correct display message when no devices are : : : accessible due to innsufficient permissions? : : : : : : --HPS : : : : : : Hans, : : : : : : what about access denied or insufficient privileges? : : : : : : Someone might have a better idea but everything should be better : : : than silently refusing to do anything. : : : : : : Volker : : : : : : Is this Ok: : : : : : : http://perforce.freebsd.org/chv.cgi?CH=155731 : : : : : : --HPS : : : : : : Eh? I still think that strerror or something along those lines would : : : be more helpful. : : : : : : You could also do : : : : : : if (getuid() != 0) { : : : errx(1, Cluebat -- you might not be able to read the usb devices : : : if you're not root); : : : } : : : : : : or... : : : : : : struct stat usb_s; : : : : : : int fd = open(..., O_RDONLY /* blah, blah... */); : : : : : : if (fd == -1) { : : : errx(1, Does the file -- %s -- exist?, file); : : : } : : : : : : if (fstat(fd, usb_s) == -1) { : : : errx(1, Couldn't stat the file: %s, file); : : : } : : : : : : if (!S_IRUSR(usb_s.st_mode) !S_IRGRP(usb_s.st_mode) : : : !S_IROTH(usb_s.st_mode)) { : : : errx(1, File not readable (do you have read permissions?)); : : : } : : : : : : /* Continue on merry way reading devices; maybe use strerror(3) for : : : more intuitive error messages? */ : : : : : : Thoughts? : : : : Do you really have to be root to find the devices, if so, that's bad. : : Very bad. xsane refuses to run as root. I have: : : : : No, no. That's wrong. : : : : Do it like this for example: : : : : usbconfig -u xxx -a xxx set_owner xxx set_perm 660 : : : : This won't have no effect at all with USB2: : : [localrules=10] : : add path 'uscanner*' mode 0660 : : : : to make it work. /dev/usb* in old usb allow listing w/o privs... : : That's bad. I'm sorry, but having to do something weird to get the : scanner to work every time isn't good design. : : I don't understand. If you are lazy you do: It has to do with providing a consistent interface to the user... : usbconfig -u xxx set_perm 777 : : That will give everyone access to all USB devices on the given controller -u : xxx. Note: No -a argument. : : Or: : : usbconfig set_owner warner:wheel set_perm 660 : : All USB devices ever plugged on your machine will be accessible by you. : : I think Rink Springer is working on something in this area. Great! I look forward to the rework... Warner ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
In message: 4963c48b.9030...@elischer.org Julian Elischer jul...@elischer.org writes: : Hans Petter Selasky wrote: : On Tuesday 06 January 2009, M. Warner Losh wrote: : In message: 200901062024.31100.hsela...@c2i.net : : Do it like this for example: : : : : usbconfig -u xxx -a xxx set_owner xxx set_perm 660 : : : : This won't have no effect at all with USB2: : : [localrules=10] : : add path 'uscanner*' mode 0660 : : : : to make it work. /dev/usb* in old usb allow listing w/o privs... : : That's bad. I'm sorry, but having to do something weird to get the : scanner to work every time isn't good design. : : I don't understand. If you are lazy you do: : : usbconfig -u xxx set_perm 777 : : how about using the standard devd stuff? You mean devfs. : why invent a completely new way of doing things for USB? Exactly my point. I can paper over this with devd, but that's really not a good way to roll long term. Warner ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
Hans Petter Selasky wrote: On Tuesday 06 January 2009, M. Warner Losh wrote: In message: 200901062024.31100.hsela...@c2i.net Hans Petter Selasky hsela...@c2i.net writes: : On Tuesday 06 January 2009, M. Warner Losh wrote: : In message: : 7d6fde3d0901061110r79333a07jf4eb134224a94...@mail.gmail.com : : Garrett Cooper yanef...@gmail.com writes: : : On Tue, Jan 6, 2009 at 10:32 AM, Hans Petter Selasky : : hsela...@c2i.net : : wrote: : : On Saturday 03 January 2009, Volker wrote: : : On 01/03/09 01:35, Hans Petter Selasky wrote: : : On Wednesday 31 December 2008, v...@freebsd.org wrote: : : Synopsis: [newusb] usbconfig(8) fails with misleading error : : when run as a normal user : : : : Responsible-Changed-From-To: freebsd-bugs-freebsd-usb : : Responsible-Changed-By: vwe : : Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 : : Responsible-Changed-Why: : : reassign : : : : http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 : : : : Hi, : : : : usbconfig will only show USB devices which the user has access : : to. : : : : What should be the correct display message when no devices are : : accessible due to innsufficient permissions? : : : : --HPS : : : : Hans, : : : : what about access denied or insufficient privileges? : : : : Someone might have a better idea but everything should be better : : than silently refusing to do anything. : : : : Volker : : : : Is this Ok: : : : : http://perforce.freebsd.org/chv.cgi?CH=155731 : : : : --HPS : : : : Eh? I still think that strerror or something along those lines would : : be more helpful. : : : : You could also do : : : : if (getuid() != 0) { : : errx(1, Cluebat -- you might not be able to read the usb devices : : if you're not root); : : } : : : : or... : : : : struct stat usb_s; : : : : int fd = open(..., O_RDONLY /* blah, blah... */); : : : : if (fd == -1) { : : errx(1, Does the file -- %s -- exist?, file); : : } : : : : if (fstat(fd, usb_s) == -1) { : : errx(1, Couldn't stat the file: %s, file); : : } : : : : if (!S_IRUSR(usb_s.st_mode) !S_IRGRP(usb_s.st_mode) : : !S_IROTH(usb_s.st_mode)) { : : errx(1, File not readable (do you have read permissions?)); : : } : : : : /* Continue on merry way reading devices; maybe use strerror(3) for : : more intuitive error messages? */ : : : : Thoughts? : : Do you really have to be root to find the devices, if so, that's bad. : Very bad. xsane refuses to run as root. I have: : : No, no. That's wrong. : : Do it like this for example: : : usbconfig -u xxx -a xxx set_owner xxx set_perm 660 : : This won't have no effect at all with USB2: : [localrules=10] : add path 'uscanner*' mode 0660 : : to make it work. /dev/usb* in old usb allow listing w/o privs... That's bad. I'm sorry, but having to do something weird to get the scanner to work every time isn't good design. I don't understand. If you are lazy you do: usbconfig -u xxx set_perm 777 how about using the standard devd stuff? why invent a completely new way of doing things for USB? That will give everyone access to all USB devices on the given controller -u xxx. Note: No -a argument. Or: usbconfig set_owner warner:wheel set_perm 660 All USB devices ever plugged on your machine will be accessible by you. I think Rink Springer is working on something in this area. --HPS ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
On 01/03/09 01:35, Hans Petter Selasky wrote: On Wednesday 31 December 2008, v...@freebsd.org wrote: Synopsis: [newusb] usbconfig(8) fails with misleading error when run as a normal user Responsible-Changed-From-To: freebsd-bugs-freebsd-usb Responsible-Changed-By: vwe Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 Responsible-Changed-Why: reassign http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 Hi, usbconfig will only show USB devices which the user has access to. What should be the correct display message when no devices are accessible due to innsufficient permissions? --HPS Hans, what about access denied or insufficient privileges? Someone might have a better idea but everything should be better than silently refusing to do anything. Volker ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
On 01/03/09 01:35, Hans Petter Selasky wrote: On Wednesday 31 December 2008, v...@freebsd.org wrote: Synopsis: [newusb] usbconfig(8) fails with misleading error when run as a normal user Responsible-Changed-From-To: freebsd-bugs-freebsd-usb Responsible-Changed-By: vwe Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 Responsible-Changed-Why: reassign http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 Hi, usbconfig will only show USB devices which the user has access to. What should be the correct display message when no devices are accessible due to innsufficient permissions? --HPS Hans, what about access denied or insufficient privileges? Someone might have a better idea but everything should be better than silently refusing to do anything. Volker ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
On Sat, Jan 3, 2009 at 10:35 AM, Volker vol...@vwsoft.com wrote: On 01/03/09 01:35, Hans Petter Selasky wrote: On Wednesday 31 December 2008, v...@freebsd.org wrote: Synopsis: [newusb] usbconfig(8) fails with misleading error when run as a normal user Responsible-Changed-From-To: freebsd-bugs-freebsd-usb Responsible-Changed-By: vwe Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 Responsible-Changed-Why: reassign http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 Hi, usbconfig will only show USB devices which the user has access to. What should be the correct display message when no devices are accessible due to innsufficient permissions? --HPS Hans, what about access denied or insufficient privileges? Someone might have a better idea but everything should be better than silently refusing to do anything. Volker Why not just simplify the problem by printing out the strerror(3) message for the actual issue -- or was that the misleading error message? Cheers, -Garrett ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
On Wednesday 31 December 2008, v...@freebsd.org wrote: Synopsis: [newusb] usbconfig(8) fails with misleading error when run as a normal user Responsible-Changed-From-To: freebsd-bugs-freebsd-usb Responsible-Changed-By: vwe Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 Responsible-Changed-Why: reassign http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 Hi, usbconfig will only show USB devices which the user has access to. What should be the correct display message when no devices are accessible due to innsufficient permissions? --HPS ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
Re: bin/129963: [newusb] usbconfig(8) fails with misleading error when run as a normal user
Synopsis: [newusb] usbconfig(8) fails with misleading error when run as a normal user Responsible-Changed-From-To: freebsd-bugs-freebsd-usb Responsible-Changed-By: vwe Responsible-Changed-When: Wed Dec 31 12:55:52 UTC 2008 Responsible-Changed-Why: reassign http://www.freebsd.org/cgi/query-pr.cgi?pr=129963 ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org