Sony PlayStation Eye – NVIDIA Jetson TX1

In our last article, we built a kernel for the Jetson TX1. In this article, we go over an example of how to build a simple module for the ubiquitous Sony PlayStation Eye for the Jetson TX1. Looky here:

Preface

Note: If all you are looking for is a prebuilt PlayStation Eye Camera driver module for the standard Jetson TX1 dev kit, check out a version on Github available here. The Github version is for the L4T 24.2 release, kernel 3.10.96-tegra.

To load the module:

$ git clone https://github.com/jetsonhacks/installPlayStationEyeTX1.git
$ cd installPlayStationEyeTX1
$ ./setupPS3Eye.sh

If you want to learn how to build modules, continue on.

PS3 Eye
PS3 Eye

Background

Way back in January 2015, we covered how to build a PlayStation Eye driver module for the Jetson TK1. The PS3 Eye’s inexpensive price, relatively good performance, and the ability to mod the device to detect infrared makes the camera a favorite among DIYers. The procedure for building the driver module for the camera is the very much the same as for the Jetson TK1.

The instructions assumed that the kernel source has been installed as described in the previous article.

$ cd /usr/src/kernel
$ sudo make xconfig

This will bring up the kernel configuration editor.

Here’s the path to enable building the camera device driver module:

Device Drivers -> Multimedia Support -> Media USB Adapters -> GSPCA based Webcams. Scroll down to OV534 OV772x USB Camera Drive

Make sure to save the kernel configuration. Next, prepare the modules, and then build them:

$ sudo make modules_prepare
$ sudo make modules SUBDIRS=drivers/media/usb/gspca

Once the module is built, it’s time to copy it over to the appropriate /lib/modules directory:

$ sudo cp /usr/src/kernel/drivers/media/video/gspca/gspca_ov534.ko /lib/modules/$(uname -r)/kernel/drivers/media/usb/gspca/

You can then insert the module:

$ sudo depmod -a
$ cd /lib/modules/$(uname -r)/kernel/drivers/media/usb/gspca/
$ sudo insmod gspca_ov534.ko

At this point, you should be good to go!

Note: If the insert module gives you an error, it main be because gspca_main is not inserted. gspca_main should be listed when you run:

$ lsmod

If gspca_main is not listed:

$ sudo insmod gspca_main.ko
$ sudo insmod gspca_ov534.ko

Running lsmod again should show both gspca_main and gspca_ov534 loaded.

Some shortcuts

Instead of copying the driver, you can run:

$ sudo make modules_install

Note that this will install all of the modules, and might cause issues.

Also, rebooting the system once the driver has been copied to the correct location should result in the driver being loaded, and mean that you don’t have to run the insmod command.

Conclusion

Hopefully by this point, you have an idea of how to build the kernel and auxiliary modules on the Jetson TX1. This is not an all inclusive description, but just a sample to get started.

22 Comments

  1. Hi Jim,
    What would this be useful for over the built in camera? 640×480 it looks like, cheap, maybe just useful in a mobile/robotic platform?

    • Hi Dan,
      The article is about building a simple module for a custom kernel, not so much about the camera itself. Someone had asked how to get the camera working with the TX1, this seemed like a good opportunity. Thanks for reading!

  2. Hello,

    Since since our systems are nearly identical:
    ubuntu@tegra-ubuntu:~$ uname -a
    Linux tegra-ubuntu 3.10.96-tegra #1 SMP PREEMPT Thu Sep 8 13:48:54 PDT 2016 aarch64 aarch64 aarch64 GNU/Linux

    ubuntu@tegra-ubuntu:~$ cat /etc/nv_tegra_release
    # R24 (release), REVISION: 2.0, GCID: 7691362, BOARD: t210ref, EABI: aarch64, DATE: Thu Sep 8 20:59:21 UTC 2016

    I just downloaded prebuilt module and by used the script you provided.

    Required modules are installed:

    ubuntu@tegra-ubuntu:~$ lsmod
    Module Size Used by
    bnep 14896 2
    gspca_ov534 12389 0
    gspca_main 24262 1 gspca_ov534
    bcmdhd 7465032 0
    cfg80211 452899 1 bcmdhd
    bluedroid_pm 11420 0

    Also dmesg:
    [ 1063.371902] usb 1-3.3: new full-speed USB device number 5 using tegra-xhci
    [ 1063.393095] usb 1-3.3: not running at top speed; connect to a high speed hub
    [ 1063.396686] usb 1-3.3: New USB device found, idVendor=1415, idProduct=2000
    [ 1063.396694] usb 1-3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [ 1063.396699] usb 1-3.3: Product: USB Camera-B4.09.24.1
    [ 1063.396704] usb 1-3.3: Manufacturer: OmniVision Technologies, Inc.
    [ 1063.396912] usb 1-3.3: ep 0x83 – rounding interval to 64 microframes, ep desc says 80 microframes
    [ 1063.397448] gspca_main: ov534-2.14.0 probing 1415:2000
    [ 1065.512557] retire_capture_urb: 30 callbacks suppressed

    However I could not check whether it is working or not. I tried to check with a simple openCV program, however it cannot open the device. At the line VideoCapture cap(1); (Assuming 0 is the onboard camera, I used cap(1) )it gets stuck. Program does not continue.

    Then, I tried vlc v4l2:///dev/video0 but all I see is black screen.

    I have a problem with cheese, so cannot use it either. I tried to uninstall and install cheese again but it does not work properly I dont know why.

    Do you have a suggestion?

    • Also I would like to ask you one more thing that I have just noticed: I think since I did not follow your steps for: “The instructions assumed that the kernel source has been installed as described in the previous article.” it does not make sense to use your binaries.

      So is it essential to follow those steps or is there another way that I can compile the required module by using my stock kernel? (By stock module I mean the one that comes after flashing my tegra with Jetpack L4T 2.3)

  3. Hi Xsentius,

    A couple of comments.
    First, the stock kernel on the TX1 is all compiled code. By downloading the kernel source and compiling it as described in the article, you replicate the compiled kernel code. Binaries are the resulting compiled code.

    The instruction “assumed that the kernel source has been installed …” is for the case when you are compiling your own module.

    Modules have some identifiers in them, such as the version of the kernel it was compiled against (e.g. 3.10.96-tegra) so that both the module and the kernel will know if it is compatible with that version. In other words, if you take a module that was compiled against a given kernel, such as the module included in the repository, and apply it to a stock kernel, it works without the need for having the source code on the machine. Indeed, that is how it was tested: On a fresh install of L4T 24.2 I downloaded the repository, and then copied the module using the script and started the camera.

    As far as why it doesn’t work, I don’t know. I didn’t have any issues, so that makes it harder to help from here. If Cheese isn’t working on your machine, that would indicate a deeper problem. Did you check the preferences to see if you could select the camera? I am not sure if the v4l driver works with this particular camera. Unfortunately I’m quite useless at debugging such things remotely, and I’m not quite sure how to proceed.

    • Hello Jim,

      First of all thank you so much for your immediate reply to my question.

      Here is the current situation: I flashed a new image today, and your kernel works well! However my problem seems to be related to something else: if I use cheese, it works for the first time, but at the second time cheese does not start properly. It freezes and hence I cannot access to my camera with openCV as well. (Also at the first time with cheese camera image is not well, there are many artifacts.)

      However if I use openCV to open the camera, then I think since I can close it properly therefore I can use it again. So my conclusion is: I should not use cheese ever.

      Sorry for bugging you, but I have a one more question: I tried reinstalling cheese but it does not solve my problem. Do you think it can be related to v4l driver? I guess it cannot initialize or close the camera properly. Do you have a suggestion for me?

  4. building the driver module worked on the TX1. Tested with Cheese Webcam Booth. Thank you.

    nvidia@tegra-ubuntu:~$ uname -r
    4.4.38-jetsonbot-v0.1

    nvidia@tegra-ubuntu:~$ lsusb
    Bus 002 Device 003: ID 0bda:0411 Realtek Semiconductor Corp.
    Bus 002 Device 002: ID 0955:09ff NVidia Corp.
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 004: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser
    Bus 001 Device 005: ID 1415:2000 Nam Tai E&E Products Ltd. or OmniVision Technologies, Inc. Sony Playstation Eye
    Bus 001 Device 003: ID 192f:0416 Avago Technologies, Pte. ADNS-5700 Optical Mouse Controller (3-button)
    Bus 001 Device 002: ID 0bda:5411 Realtek Semiconductor Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

      • Hi Kangalow, thank you for replying.

        The camera is plugged into the Jetson, ls in GSPCA gives:
        ubuntu@tegra-ubuntu:/usr/src/linux-headers-4.4.38-tegra/drivers/media/usb/gspca$ ls
        gl860 Kconfig m5602 Makefile stv06xx.

        Thinking about it, I might forgot the USB Modem (CDC ADC) support for ttyACM support of the USB (mentioned here:https://www.jetsonhacks.com/2017/07/31/build-kernel-ttyacm-module-nvidia-jetson-tx2/).

        Should I rebuilt kernel in order to recognize and operate the camera?

        • Did you check to see if you built it as a module, and not part of the Kernel? In other words, is there a check mark or a circle next to:
          OV534 OV772x USB Camera Driver

          • In /usr/src/linux-headers-4.4.38-tegra there currently is a check mark next to OV534 OV772x USB Camera Driver. It used to be a circle.

            If I remake the kernel using xconfig in /usr/src/kernel/kernel-4.4 will that be of help?

            • The check mark indicates that it was built into the kernel Image, and is not a module. Therefore it would not show up as a module, i.e. gspca+ov534.ko. You can mark it as a module and remake it or you can create the Image file and use that.

              • Hi Kangalow,

                Thank you for your patience.

                I booted the TX2 with L4T 28.2. Succesfully installed the kernel and am able to install gspca_ov534.ko. Now I encounter the problem of installing gspca_main.ko since it is not listed in lsmod.

                I try to:
                nvidia@tegra-ubuntu:/lib/modules/4.4.38-jetsonbotv0.1/kernel/drivers/media/usb/gspca$ sudo insmod gspca_main.ko
                insmod: ERROR: could not insert module gspca_main.ko: Invalid module format

                Any idea how to solve this? I’m almost there I think….

  5. The name of the file that you are looking for is gspca_ov534.ko
    Did you check
    $ lsmod
    to see if the module is loaded?
    What is the result of:
    $ lsusb
    You appear to be searching in the linux-headers, you should be looking in the kernel source tree or the system tree.

    • Hi Kangalow,

      I’ve been away for a week. Here are the resutls of the commands.

      nvidia@tegra-ubuntu:~$ lsmod
      Module Size Used by
      snd_usb_audio 183331 0
      snd_hwdep 8187 1 snd_usb_audio
      snd_usbmidi_lib 26400 1 snd_usb_audio
      fuse 89760 4
      bcmdhd 7633912 0
      pci_tegra 75137 0
      bluedroid_pm 13564 0
      nvidia@tegra-ubuntu:~$ lsusb
      Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
      Bus 001 Device 003: ID 413c:2003 Dell Computer Corp. Keyboard
      Bus 001 Device 005: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse
      Bus 001 Device 004: ID 1415:2000 Nam Tai E&E Products Ltd. or OmniVision Technologies, Inc. Sony Playstation Eye
      Bus 001 Device 002: ID 214b:7000
      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

      I can find a ov534 file in the following directory. In the /usr/src/kernel there is no drivers folders but I found it in kernel-4.4
      nvidia@tegra-ubuntu:/usr/src/kernel/kernel-4.4/drivers/media/usb/gspca$ contains:
      ov534.c / gspca_main.o but no .ko files.

      I’m thinking to redo the booting. I made the kernel from the linux-headers which may caused the problems. Is there a safe way to delete a kernel and restart the process from the kerenl-4.4 folder?

      Regards,

      Floris

Leave a Reply

Your email address will not be published.


*