Announcement

Collapse
No announcement yet.

Can't connect my Allwinner as a usb webcam

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't connect my Allwinner as a usb webcam

    I'm struggling to plug my allwinner cam to use it as a USB webcam on linux.
    This is the camera and its original firmware (attached).

    Code:
    Product:       fx1gddrimx179vpq-sdv
    Manufacturer:  lzm
    Short id:      fuxin
    OEM id:        zhongxing_ir
    Camera type:   fx2830
    FW orig. date:
    FW mod. date:  20171012
    FW date:
    Camera name:
    Version:        20180903V25
    LCD model:     ili9225
    LCD resolution: 220x176
    LCD count:    1
    Sensor model: imx179v
    When I switch the camera to its 'PC CAMERA' mode inside its menu (see picture), the camera briefly shows a camera logo (which I assume indicates it enters its usb mode) and returns to the menu. It won't stay the 'PC CAMERA'.

    This is confirmed by 'dmesg':

    Code:
    [] usb 1-3: new high-speed USB device number 16 using ehci-pci
    [] usb 1-3: New USB device found, idVendor=1f3a, idProduct=1002, bcdDevice= 2.33
    [] usb 1-3: New USB device strings: Mfr=2, Product=3, SerialNumber=4
    [] usb 1-3: Product: Android
    [] usb 1-3: Manufacturer: USB Developer
    [] usb 1-3: SerialNumber: 20080411
    [] usb-storage 1-3:1.0: USB Mass Storage device detected
    [] scsi host5: usb-storage 1-3:1.0
    [] scsi 5:0:0:0: Direct-Access     USB 2.0  USB Flash Driver 0100 PQ: 0 ANSI: 2
    [] sd 5:0:0:0: Power-on or device reset occurred
    [] sd 5:0:0:0: [sdb] Attached SCSI removable disk
    [] usb 1-3: USB disconnect, device number 16
    [] usb 1-3: new high-speed USB device number 17 using ehci-pci
    [] usb 1-3: New USB device found, idVendor=1f3a, idProduct=100e, bcdDevice= 2.33
    [] usb 1-3: New USB device strings: Mfr=2, Product=3, SerialNumber=4
    [] usb 1-3: Product: Android
    [] usb 1-3: Manufacturer: USB Developer
    [] usb 1-3: SerialNumber: 20080411
    [] uvcvideo: Found UVC 1.00 device Android (1f3a:100e)
    [] uvcvideo: Failed to query (GET_INFO) UVC control 2 on unit 1: -110 (exp. 1).
    [] uvcvideo: Failed to query (GET_INFO) UVC control 2 on unit 2: -32 (exp. 1).
    [] uvcvideo 1-3:1.0: Entity type for entity Processing 2 was not initialized!
    [] uvcvideo 1-3:1.0: Entity type for entity Camera 1 was not initialized!
    [] input: Android: UVC Camera as /devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:1.0/input/input20
    [] usb 1-3: USB disconnect, device number 17
    [] usb 1-3: new high-speed USB device number 18 using ehci-pci
    [] usb 1-3: New USB device found, idVendor=1f3a, idProduct=1002, bcdDevice= 2.33
    [] usb 1-3: New USB device strings: Mfr=2, Product=3, SerialNumber=4
    [] usb 1-3: Product: Android
    [] usb 1-3: Manufacturer: USB Developer
    [] usb 1-3: SerialNumber: 20080411
    [] usb-storage 1-3:1.0: USB Mass Storage device detected
    [] scsi host5: usb-storage 1-3:1.0
    [] scsi 5:0:0:0: Direct-Access     USB 2.0  USB Flash Driver 0100 PQ: 0 ANSI: 2
    [] sd 5:0:0:0: Power-on or device reset occurred
    [] sd 5:0:0:0: [sdb] Attached SCSI removable disk
    I believe that the line worth noting are

    Code:
    [] uvcvideo: Found UVC 1.00 device Android (1f3a:100e)
    [] uvcvideo: Failed to query (GET_INFO) UVC control 2 on unit 1: -110 (exp. 1).
    [] uvcvideo: Failed to query (GET_INFO) UVC control 2 on unit 2: -32 (exp. 1).
    and

    Code:
    [] sd 5:0:0:0: Power-on or device reset occurred

    Since the uvcvideo module seems to fail with the camera, I tried to manually load another module
    Code:
    sudo modprobe gspca_sunplus
    but it doesn't seem to change anything.

    My questions are:
    - Is it common for some firmwares to be defective for usb-webcam support?
    - What other firmware can I flash on my camera?
    - What other module can I try on my linux box?
    - Any other idea I could try?

    Attachment the firmware:
    https://drive.google.com/file/u/1/d/...jZUk6Amn-/view


  • #2
    hey dtralara . thanks for sharing! did you already share this firmware in April of this year?

    hm. that's odd. it worked for me in Linux Mint 19 (could be 19.1) and 'guvcview' software. See here - click this link

    Remove your sd-card first, and install 'guvcview' ( http://guvcview.sourceforge.net ) or another UVC compatible software package. And try again.

    1. - Is it common for some firmwares to be defective for usb-webcam support?
    2. - What other firmware can I flash on my camera?
    3. - What other module can I try on my linux box?
    4. - Any other idea I could try?
    Answers to your questions:
    1. - yes. these cams are cheap, $20 USD and up.

    2. - your firmware is 8126464 bytes size, so you can search this number "8126464" and match the same LCD and sensor.
    - watch the flash-firmware video from TIME 13:50 https://youtu.be/QrTxFjIiHvc?t=830 (do not use ADB)

    3. - modules? such as "modprobe ..." . not sure. but install 'guvcview' , install "uvcdynctrl" - click here , and read info online - https://wiki.archlinux.org/index.php/Webcam_setup

    4. - try another camera to be sure that your Linux setup is working. Try other usb ports. sometimes USB2.0 (not3.0) works better for cheap hardware. Try other (better) USB cables.

    For the google drive link that you now shared, I had to re-organize and rename the .img files, and run the 'refex.bat' script. Hm challenging but interesting and educational

    In the future, please use this backup script for Debian/Ubuntu Linux - https://www.dropbox.com/s/txrjqgu8nb...press.zip?dl=0
    and here are more backup scripts for Windows/Mac - https://www.goprawn.com/forum/allwin...5025#post15025
    - These scripts properly make all 0/1/2/3/4/5/6 .img files and make a 'full_img.fex' file, all nicely wrapped in a .zip or .rar compressed file.

    Use this unfex-refex scripts for your 'nk' firmware - https://www.dropbox.com/s/6n6f4i8r3u...26464.zip?dl=0
    Here are more unfex-refex scripts for other firmware - https://glot.io/snippets/fcg8vyjyyv/...links-list.txt

    your FW info:
    Code:
    Product:  
       fx1gddr imx179vpq-sdv
    Manufacturer:  
       lzm
    Short id:  
       fuxin
    OEM id:  
       zhongxing_ir
    Camera type:  
       fx2830
    FW orig. date:  
       20180319
    FW mod. date:  
       20171012
    Camera name:  
       (nk)
    Version:  
       20180903V25
    LCD model:  
       ili9225ghsd
    LCD resolution:  
       220x176  
    LCD count:  
       1
    Sensor model:  
       imx179v
       (this could be imx179s or imx175, but unsure)
    Wifi:
       xradio
    Logo:
       nk
    FULL_IMG.FEX size:
       8126464 bytes
    Last edited by petesimon; 09-09-2019, 04:13 AM.

    Comment


    • petesimon
      petesimon commented
      Editing a comment
      could also install "v4l-utils" and to this command:
      Code:
      v4l2-ctl --list-devices
      .
      manpage - http://manpages.ubuntu.com/manpages/...4l2-ctl.1.html

      Also, something about cameras using too much USB bandwidth may cause problems
      https://wiki.archlinux.org/index.php..._Studio/Cinema

      this text in '/etc/modprobe.d/uvcvideo.conf' file should be written if you want to set the parameter:
      Code:
      options uvcvideo quirks=0x80
      .
      then do these commands (once before reboot, but not needed for 2nd, 3rd ... reboots)
      Code:
      rmmod uvcvideo
      modprobe uvcvideo
      .
      values 0x100 or bigger are okay too.
      Last edited by petesimon; 09-09-2019, 04:39 AM.

  • #3


    Thanks for your help.

    I've tried various v4l2 viewer applications but the uvcvideo module keeps complaining.

    I managed to get a feed in one particular case: if I open qv4l2 (v4l2-utils) and pick the device
    Code:
     /dev/video0
    fast enough before it disappears, the camera stays in the 'PC CAMERA' mode and the usb playback works.

    The uvcvideo module complains the entire time:
    Code:
    [] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -110 (exp. 2).
    [] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -110 (exp. 2).
    [] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -110 (exp. 2).
    [] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -110 (exp. 2).
    [] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -110 (exp. 2).
    [] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -110 (exp. 2).
    [] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -110 (exp. 2).
    But the usb playback works (at least for a couple of minutes)

    If I'm not quick enough however, the devices

    Code:
    /dev/video0
    /dev/video1
    disappear (after 1 second) and the camera returns to its menu.


    Thank your for your suggestions. So far I've tried:
    1. different cables and different usb ports.
    2. changing the buffering as you suggested (options quirks=0x80 or 0x100 for the uvcvideo module).
    3. using a different linux (ubuntu instead of arch)
    But nothing improves the behavior.

    So now, I will try
    1. Finding a compatible firmware on the list and flash it
    This is the list, right?
    https://www.goprawn.com/forum/allwin...?p=130#post130



    Comment


    • petesimon
      petesimon commented
      Editing a comment
      yes https://www.goprawn.com/forum/allwin...ameras#post130 is the list
      be sure to remove SD card first. and did you also try another action-camera or webcam via USB in Linux?
      you could search for firmware that is 8126464 bytes as the size. also could search for fw 7798784 bytes size. you get the idea?

  • #4

    Postscriptum:

    PS1:
    Yes, I already uploaded this firmware (as a single full_img.fex file at the time). I should have made this clearer. I used the names as they appeared in the /proc/mtd table. Sorry for the inconvenience.

    PS2:
    Thanks for the backup.sh linux script. I wish I had found it back in april. For information, the script didn't work as is for my camera. dd is missing on this camera. So either I use their 'toolbox dd' or I push busybox
    Code:
        adb push busybox-armv7r /busybox
        adb shell
        chmod 555 busybox
    Either way, I needed to modify line 48 accordingly.

    PS3:
    Thanks for the FW info. Did you extract it with the 'refex.bat' script?
    You've probably been asked this a million time already but, where is this script?
    Is it this one?
    https://www.dropbox.com/s/6n6f4i8r3u...26464.zip?dl=0
    Any bash (linux friendly) version available somewhere here?

    PS4 (unrelated):
    Is there a tag, like [code] that formats the text into monospace code text but within a paragraph?



    Comment


    • petesimon
      petesimon commented
      Editing a comment
      In Linux on a computer:
      In reference to PS2 above, and for other people reading this: some Allwinner V3x firmware can't do 'dd' command. So, we could instead use these 'adb pull' commands and without using 'dd' or 'busybox'/'toolbox' commands.
      Code:
      adb kill-server
      adb root
      adb remount
      adb pull /dev/block/mtdblock0 0-uboot.img
      adb pull /dev/block/mtdblock1 1-boot.img
      adb pull /dev/block/mtdblock2 2-system.img
      adb pull /dev/block/mtdblock3 3-config.img
      adb pull /dev/block/mtdblock4 4-blogo.img
      adb pull /dev/block/mtdblock5 5-slogo.img
      adb pull /dev/block/mtdblock6 6-env.img
      cat 0-uboot.img 1-boot.img 2-system.img 3-config.img 4-blogo.img 5-slogo.img 6-env.img > full_img.fex
      ls -l *img
      ls -l *fex
      .
      .
      and here is the 'busybox dd' method. be sure an SD card with 50 MB free space is inserted into the camera
      Code:
      # use "wget https://busybox.net/downloads/binaries/1.21.1/busybox-armv7l" or use the next line
      wget https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-armv7l
      adb kill-server
      adb root
      adb remount
      adb push busybox-armv7l /busybox
      adb shell chmod 755 /busybox
      adb shell mkdir /mnt/extsd/backup
      adb shell /busybox dd if=/dev/block/mtdblock0 of=/mnt/extsd/backup/0-uboot.img
      adb shell /busybox dd if=/dev/block/mtdblock1 of=/mnt/extsd/backup/1-boot.img
      adb shell /busybox dd if=/dev/block/mtdblock0 of=/mnt/extsd/backup/2-system.img
      adb shell /busybox dd if=/dev/block/mtdblock0 of=/mnt/extsd/backup/3-config.img
      adb shell /busybox dd if=/dev/block/mtdblock0 of=/mnt/extsd/backup/4-blogo.img
      adb shell /busybox dd if=/dev/block/mtdblock0 of=/mnt/extsd/backup/5-slogo.img
      adb shell /busybox dd if=/dev/block/mtdblock0 of=/mnt/extsd/backup/6-env.img
      adb pull /mnt/extsd/backup
      cd backup
      cat 0-uboot.img 1-boot.img 2-system.img 3-config.img 4-blogo.img 5-slogo.img 6-env.img > full_img.fex
      ls -l
      .
      .
      PS3: https://www.dropbox.com/s/6n6f4i8r3u...26464.zip?dl=0 is the link for 8126464 bytes firmware. Scripts for other sizes of fw are here - https://glot.io/snippets/fcg8vyjyyv/...links-list.txt
      Read the 'readme txt' file inside the zip file But I extracted information by a combination of actions. First run these scripts:
      Code:
      unfex.bat
      scriptbin_read.bat
      convertscriptbin.bat       # you will need Java installed
      squashfs_unmake.bat
      fwinfo.bat
      getfwinfo.bat
      cd squashfs-root/vendor/modules
      .
      And look for modules files that are used for hardware such as 'imx179s.ko' or 'ov4689.ko' for image sensors, or 'xradio_core.ko' for Wifi.

      more PS3:
      Any bash (linux friendly) version available somewhere here?
      No.
      You and I should make a github or a similar online source-code account and collaborate to make Linux scripts.
      For starts, let's submit the code inside this - https://www.dropbox.com/s/txrjqgu8nb...press.zip?dl=0

      PS4: check a vbulletin user guide. such as this https://www.vbulletin.org/forum/misc.php?do=bbcode
      Last edited by petesimon; 09-11-2019, 12:13 PM.

    • petesimon
      petesimon commented
      Editing a comment
      also, more backup (not unfex/refex) scripts are here - https://glot.io/snippets/fcg8vyjyyv/...-mac-linux.txt

      *Update - here is the ported 'unfex' script to use in Linux for 12058624 bytes size 'full_img.fex' files - https://drive.google.com/open?id=1DQ...brRhyTET92uA0E

      Extract the zip file, put full_img.fex file in the same place, and run the command. Look in a new UNFEX folder for new .img files.
      Code:
      bash ./unfex.sh
      .
      When I have time, I will port each script (starting at the smallest / least complex) as a .sh shell script to use in Linux.
      Last edited by petesimon; 09-12-2019, 04:09 AM.

  • #5
    Questions about firmwares and compatibility.

    yes https://www.goprawn.com/forum/allwin...?p=130#post130 is the list
    be sure to remove SD card first. and did you also try another action-camera or webcam via USB in Linux?
    you could search for firmware that is 8126464 bytes as the size. also could search for fw 7798784 bytes size. you get the idea?
    I downloaded every zip file listed in post, so I could look for an full_img.fex that satisfies every compatibility requirements as I understand them:
    - firmware size,
    - sensor type,
    - LCD model.

    Off the 143 links in the post, only 3 are smaller than 12M. Off those 3, only 1 seems to have a sensor of type imx179. And its LCD model seems incompatible with mine (ili9225ghsd):
    Code:
    ------------
    Link:     0B4tyaJWIqCb_dEx1R0twdE5ULWM
    Product:  crane-sdv
    Size:     8388608  
    Sensor:   gc2023_mipi_2lane
    LCD:      ili9341
    ------------
    Link:     0B4tyaJWIqCb_d1QxaFJYOVBxM3M
    Product:  crane-sdv
    Size:     8388608
    Sensor:   gc2023_mipi_2lane
    LCD:      ili9341
    ------------
    Link:     0B4tyaJWIqCb_RHlCUHNyMUp4TnM
    Product:  crane-sl609
    Size:     7798784
    Sensor:   imx179
    LCD:      st7789
    ------------
    I'm a bit confused. So I have 3 questions:

    1. Is the firmware size a firm requirement? What indicates that my hardware won't accept a 12M firmware? In your experience, do cameras have various capacities?

    2. How about the LCD controllers? In your experience, does a firmware only handle one type of LCD controller or does it detect the hardware (through some sort of udev) and load the correct kernel modules accordingly?

    3. Are all the candidate firmwares you gathered listed that single post?

    Thanks again for your help.

    Comment


    • petesimon
      petesimon commented
      Editing a comment
      Hey dt.
      1. firmware size is not 'per se' a requirement. however, some firmware files too large for nand/mmc in your camera will just brick the camera or otherwise cause boot problems. The real capacity of nand/mmc storage in the camera can be found by querying the size of a block-storage-device from a special file in '/dev/block' or maybe in '/sys/class/block' directory, such as '/dev/block/mmcblk0' or '/sys/class/block/mmcblk0/size'. Connect the camera by USB to computer, and use 'adb shell' and then other commands. I forgot exactly how to do this. Maybe use 'blkid' command or 'blockdev --getsize64 /dev/block/mmcblk0'. Not sure. I would have to use a camera in real-time to check what works.

      Yes, diff cameras have various capacities. See post #6 here. https://www.goprawn.com/forum/allwin...?p=121#post121

      2. Yes, one stock firmware (without modification) handles only one LCD model. Hardware settings including the LCD model are set in the first ~36272 bytes in the binary file 0-uboot.img (and this is copied from /dev/mtdblock0). We can rip this data and save it as a 'script.bin' file. Luckily, we can write a 'script.bin' from one camera to 0-uboot.img of another (2nd) camera and then flash the modified 0-uboot.img to the 2nd camera. This effectively can change the LCD model but sometimes can cause problems.

      3. No. I already wrote before in post #3 -- search for firmware size 8126464 bytes and 7798784 bytes.
      *** Literally use the search function box for these numbers in Goprawn forums -- look at the top of any page.

      Also, here is a backup.sh script for Linux that uses 'adb shell' commands without busybox or 'dd', and without the need to use a SD card.
      https://drive.google.com/open?id=1EY...FHoSQLc7HKKI3K

      Cheers 🤓
      Last edited by petesimon; 09-15-2019, 07:31 AM.

    • dtralara
      dtralara commented
      Editing a comment
      Thank you so much for your answer and these clarifications.

      It's going to help for sure.

      Thanks for the linux backup procedure too, it's really useful. It's easier to understand and it seems to make less assumptions on the firmware. I love it.

      By the way, let me apologize for my (possibly naive) questions. Everything is quite new to me. So this makes difficult understanding/absorbing or even navigating the site.
      So I apologize for making you repeat yourself.

      Best

    • dtralara
      dtralara commented
      Editing a comment
      Thank you so much for your answer and these clarifications.

      It's going to help for sure.

      Thanks for the linux backup procedure too, it's really useful. It's easier to understand and it seems to make less assumptions on the firmware. I love it.

      By the way, let me apologize for my (possibly naive) questions. Everything is quite new to me. So this makes difficult understanding/absorbing or even navigating the site.
      So I apologize for making you repeat yourself.

      Best

    • petesimon
      petesimon commented
      Editing a comment
      Totally alright. You're kindly welcome. This is my hobby and I enjoy it.

      Also, here are Linux scripts that I recently made for doing unfex, refex, fwinfo and more...
      Download - https://is.gd/JpS1yA
Working...
X