LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   installing an USB peripheral (https://www.linuxquestions.org/questions/linux-hardware-18/installing-an-usb-peripheral-4175459255/)

nymar 04-23-2013 05:18 AM

installing an USB peripheral
 
Hi,

I'm trying to install an USB peripheral http://www.kvaser.com/en/products/can/usb.html.
This is what i did i download the linux driver i compiled it with my arm-linux- compiler and set the KERNEL_SOURCE_DIR to my kernel source as it asks for.
After compilation i sent the file to my raspberryPI and i installed USBCAN II driver thanks to the setup shell provided with the driver.
Code:

    #!/bin/sh

    DEPMOD=`which depmod`
    UDEVCTRL=`which udevcontrol`
    UDEVADM=`which udevadm`

    install -D -m 700 usbcanII.ko /lib/modules/`uname -r`/kernel/drivers/usb/misc/usbcanII.ko
    install -m 700 usbcanII.sh /usr/sbin/
    if [ -d /etc/hotplug ] ; then
      install -m 777 usbcanII/usbcanII /etc/hotplug/usb/ ;
      install -m 644 usbcanII/usbcanII.usermap /etc/hotplug/usbcanII.usermap
    fi
    install -m 644 ../10-kvaser.rules /etc/udev/rules.d

    if [ `udevd --version` -lt 128 ] ; then
      $UDEVCTRL reload_rules ;
    else
      $UDEVADM control --reload-rules ;
    fi

    $DEPMOD -a
    if [ "$?" -ne 0 ] ; then
      echo Failed to execute $DEPMOD -a
    fi

but when i connect it i got the following output
Code:

[root@raspberrypi ~]# dmesg | tail
usb 1-1.2.4: chopping to 0 config(s)
usb 1-1.2.4: string descriptor 0 read error: -32
usb 1-1.2.4: New USB device found, idVendor=0bfd, idProduct=0004
usb 1-1.2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1.2.4: no configuration chosen from 0 choices
usb 1-1.2.4: No support over 500mA
Registered led device: led0
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

lsusb -v gives me
Code:

    Bus 001 Device 006: ID 0bfd:0004 Kvaser AB USBcan II
    Device Descriptor:
      bLength                18
      bDescriptorType        1
      bcdUSB              1.00
      bDeviceClass          255 Vendor Specific Class
      bDeviceSubClass        0
      bDeviceProtocol        0
      bMaxPacketSize0        64
      idVendor          0x0bfd Kvaser AB
      idProduct          0x0004 USBcan II
      bcdDevice            0.01
      iManufacturer          1
      iProduct                2
      iSerial                0
      bNumConfigurations      0
    Device Status:    0x0001
      Self Powered


theNbomr 04-23-2013 11:35 AM

I'll hazard a guess that the USB-CANbus dongle is pulling the power supply down briefly when connecting. What happens if you boot the RPi with the USB-CANbus dongle already connected? Does the device work correctly after hot-plugging?

--- rod.

nymar 04-24-2013 04:20 AM

Thank you for your answer but hot-plugging does not resolve the problem. The PWR led is still flashing and i have the same message.
I forgot to mention that the install.sh didn't work pretty fine in fact when i run it i have
Code:

[root@raspberrypi usbcanII]# ./installscript.sh
which: no udevcontrol in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/bin)
./installscript.sh: line 15: udevd: command not found
./installscript.sh: line 15: [: -lt: unary operator expected


theNbomr 04-24-2013 10:57 AM

Well, it looks like your Rpi doesn't have a standard installation of udev. The CANbus dongle probably requires the USB subsytem udev rules to load a driver for the dongle when it is hot-plugged. Since the installation of the udev rules failed, no such rule gets invoked. If udev is installed, then you should either manually install the kvaser udev rules, or add the udev components to your $PATH before running the installation script. If udev isn't installed, then you should probably install it.

--- rod.

nymar 04-25-2013 03:58 AM

Quote:

Originally Posted by theNbomr (Post 4938064)
Well, it looks like your Rpi doesn't have a standard installation of udev. The CANbus dongle probably requires the USB subsytem udev rules to load a driver for the dongle when it is hot-plugged. Since the installation of the udev rules failed, no such rule gets invoked. If udev is installed, then you should either manually install the kvaser udev rules, or add the udev components to your $PATH before running the installation script. If udev isn't installed, then you should probably install it.

--- rod.

Thanks for your reply.

Well, if i remember well i had problems with udev when i build the rootfs, but here i added the path for udev and i executed ./installscript.sh successfully but i still can't run the device :(

theNbomr 04-25-2013 08:01 AM

Does the device driver load (look for evidence in /var/log/messages)? Is there a device node created ( eg /dev/can0 )? What do you mean by 'had problems with udev'? Is it installed, or not? If no, then you should install it. Are your udev rules for the device now installed according to the installation script? What exactly do you mean by 'can't run the device'? Do you have some test software that is known to be good? If the device node is present, does it have permissions suitable to the UID of the code you're trying use to test it? What rules are in the vendor supplied udev config file? Is there evidence that they are being applied?

--- rod.

nymar 04-25-2013 08:21 AM

i really appreciate your help. I'll try to answer the quetions that i understood
/for udev i had errors when i built the rootfs
/for the driver i think it's loaded for the node in /dev how can i guess that a device is for my usbcan ?
/what i mean with 'can't run it' there's a PWR led in the device that flashes instead of being steady (normal status like with my pc)
Now what's new is that a friend of mine (more qualified) made an update for the firmware and now i don't have this messages
usb 1-1.2.4: no configuration chosen from 0 choices
usb 1-1.2.4: No support over 500mA
and the led is steady now but as i understand the device is turned with a generic module (i'm not really understanding what i say) in an other way lsmod doesn't show usbcanII driver like before. But the problem that the examples provided with th driver (that we test with pc and worked) doesn't work with Raspberry Pi.
Another question if u don't mind i want to use another kernel with my old root file system what should i change only the image.ko ?
Hope that you can help me.

theNbomr 04-25-2013 09:08 AM

Okay, it looks like the driver is not loading. Monitor /var/log/messages (tail -f) as root when you plug the USB CANbus dongle into the Rpi. Do you see anything related to your device? If no, then no driver is loading, or the driver is not recognizing the presence of the device. Since the driver is no longer showing up in the output of lsmod, it sounds like the device is not being recognized. Did the firmware update complete successfully? Use lsusb to list devices attached to the USB. Does your device show up? Can you manually load the driver with insmod or modprobe? Can you roll back to the older firmware to see if the old behavior is restored?

When you built the root filesystem, and you saw errors related to udev, did you correct those errors? It is impossible to know what to expect from udev without knowing whether it is fully present.

Usually, the device node name is recognizable by its name. I would expect the device node name to suggest something about CANbus; something like /dev/can0.

For questions about kernel upgrades, you should start a new thread, or ask on a RPi forum. Do note that you will need to rebuild your CANbus driver against the sources for your new kernel.

--- rod.

samiaeg 04-25-2013 10:40 AM

Quote:

Originally Posted by theNbomr (Post 4937336)
I'll hazard a guess that the USB-CANbus dongle is pulling the power supply down briefly when connecting. What happens if you boot the RPi with the USB-CANbus dongle already connected? Does the device work correctly after hot-plugging?

--- rod.

nice explanation

theNbomr 04-25-2013 10:47 AM

Quote:

Originally Posted by samiaeg (Post 4938723)
nice explanation

Not sure if you're being facetious here or not. If so, please elaborate.
--- rod.

nymar 04-26-2013 08:21 AM

what about this dmesg --->
Code:

usbcanII: disagrees about version of symbol module_layout
??

theNbomr 04-26-2013 10:50 AM

Looks bad. More context needed. I've asked you a lot of questions. Diagnosis of the problem depends on the answers to those questions. Before a remedy can be effected, the cause of the problem must first be determined.

--- rod.


All times are GMT -5. The time now is 04:02 PM.