ARGENTOP2P

Soporte, Ayuda y Consultas => Linux => Mensaje publicado por: elrosti en Mayo 15, 2008, 00:03:37

Título: problemas con usbdevfs y jusb
Publicado por: elrosti en Mayo 15, 2008, 00:03:37
Amigos.

Primero que nada estoy usando openSuSE 10.2 de 32 bits.

Estoy necesitando usar una librería JAVA llamada "jUSB" para acceder al puerto USB desde mis programas JAVA. Al querer ejecutar la aplicaciónd e prueba memustra el siguiente error

"I/O exception: USB Host support is unavailable."

Buscando un poco con google y alguna otra información que he encontrado no logro saber la solución al problema, espero que me ayuden a unir todas las partes  :P.

En el "INSTALL" de la librería me dice algo como esto:

CitarLINUX KERNEL

For your OS kernel, use Linux 2.4.0 or later.  There's USB support in
the 2.2.18 kernel, but you may run into the need for a patch to handle
timer interrupts safely (ignoring them till usbdevfs requests finish).


SECURITY:  USBDEVFS, RMI

The Linux implementation of jUSB builds on APIs exposed by the "Prototype
USB Device File System" (as it's called in the kernel configuration).
You can look at the files in /proc/bus/usb.  There are two text files
used in basic troubleshooting, but the numerically named files are the
ones which jUSB uses, and which you need to be able to read and write.

On a single-user machine consider "devmode=0666" in your usbdevfs entry
in /etc/fstab (or where ever you set that up), so you won't need to
work as root.  On a multi user system, consider the "devuid" or "devgid"
options (same goal).

You can run an RMI version of the Java USB Daemon so that you can use USB
devices without being root all the time, even if you don't set "devmode=0666".
Be careful; there's no access control with the current RMI support, and
people from other machines (that may be less trustworthy) can do it too.

En google encontré alguien que tenía el mismo problema que yo y la respuesta fue la siguiente:

Citar> I'm trying to use jphoto to get pictures from my Kodak DX-3600. When I try to
> run it I get "I/O exception: USB Host support is unavailable."
>
> How do I enable usbdevfs?

Recompile the kernel and in "USB Support" menu check
   Preliminary USB device filesystem

If you have debian, usbmgr will mount
   /proc/bus/usb on /proc/bus/usb type usbdevfs (rw)
otherwise, do it manually or in /etc/fstab

Aquí hay otra pregunta y respuesta:

Citar> hey everyone,
> is anyone running the jsb package sucessfully on linux? I am
> running Redhat 8 and have compiled in ehci device support, but for
> some reason I'm getting an exception:
> java.io.IOException: USB Host support is unavailable
>
> I can't seem to find anyone else with this error, and reading the jusb
> docs on sourceforge hasn't helped. any ideas?

Hey Paul:

        It's working just fine here. I strongly suggest, however, that instead
of downloading their .tgz file off SourceForge that you go and grab the
sources directly from their CVS tree.

        Once downloaded and built, you need to ensure that libjusb.so gets
copied over to $JAVA_HOME/jre/lib/i386, and that it has read and evecute
permissions for your user. Also ensure that you have the usbdevfs
virtual device mounted, and that your user has proper R/W access to it.

        Lastly, depending on what USB device you want to talk to, you _may_
need to disable hotplug (or at least blacklist any installed modules
that may also attempt to talk to your device). If the device already
has support in Linux, hotplug will load it's associated module and give
it exclusive I/O access before you can grab the device from jUSB.


y aquí hay otra pregunta mas referida al tema pero sobre VMWare:

CitarWMware doesn't recognize USB devices. That's because VMware (release 18.7.2006) only knows the usbfs.


[edit]
Solution:

within /etc/fstab change the following line:

usbdevfs /proc/bus/usb usbfs noauto 0 0

to

usbfs /proc/bus/usb usbfs rw,devgid=108,devmode=0660,busgid=108,busmode=0770,listgid=108,listmode=0660 0 0

edit-this line does not work, probably a bad entry for "devmode" try "devmode=0666"

Create group usbfs with gid=108 and add a vmware user to this group.

Por las dudas mi fstab tiene lo siguiente:

/dev/hda6            /                    ext3       acl,user_xattr        1 1
/dev/hda1            /windows/C           ntfs       ro,users,gid=users,umask=0002,nls=utf8 0 0
/dev/hda2            /windows/D           vfat       users,gid=users,umask=0002,utf8=true 0 0
/dev/hda5            swap                 swap       defaults              0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
/dev/fd0             /media/floppy        auto       noauto,user,sync      0 0


de todos modos no tengo ninguna carpeta /proc/bus/usb (solo llega hasta "bus")

Si alguien me ayuda a unir toda esta información para llegar a la solución le estaré eternamente agradecido, porque para mi es demasiado para mis conocimientos  :P.

Desde ya gracias.
Título: Re: problemas con usbdevfs y jusb
Publicado por: ZeiterZ en Mayo 15, 2008, 00:54:17
Me parece que el problema está en que no habilitas del usbfs en  /etc/fstab

Vos tienes

usbfs                /proc/bus/usb        usbfs      noauto                0 0

cuando debería tener "auto".

Por lo menos, en Debian esa línea no existe en /etc/fstab pero aún así el sistema usbfs se automonta al arrancar en /proc/usb

No sé cómo será en OpenSuse.

Saludos.