Raspberry Pi webcam unable to open video device - raspberry-pi

Error " Unable to open video device "
I am using a HP Deluxe Webcam (EW193AA) with raspberry pi
log of lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 006: ID 093a:2621 Pixart Imaging, Inc. PAC731x Trust Webcam
Bus 001 Device 005: ID 413c:2107 Dell Computer Corp.
log of motion -n
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478785
[0] Thread 1 is from /etc/motion/motion.conf
[0] httpd bind(): Address already in use
[0] httpd thread exit
[1] Thread 1 started
[1] cap.driver: "gspca_pac7302"
[1] cap.card: "USB Camera (093a:2621)"
[1] cap.bus_info: "usb-bcm2708_usb-1.2"
[1] cap.capabilities=0x85000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Config palette index 8 (YU12) doesn't work.
[1] Supported palettes:
[1] 0: PJPG (PJPG)
[1] Unable to find a compatible palette format.
[1] ioctl (VIDIOCGCAP): Inappropriate ioctl for device
[1] Could not fetch initial image from camera
[1] Motion continues using width and height from config file(s)
[1] Resizing pre_capture buffer to 1 items
[1] bind(): Address already in use
[1] Problem enabling stream server in port 8081: Address already in use
[1] Thread exiting
[0] Motion thread 1 restart
I have tried changing width and height to 160*140, 320*240,640*480 but resulted in same error.... but cannot find a solution...

Logfile says your port 8081 is already in use...
please also ensure that your outpath is write enabled for user motion.motion:
eg.
sudo chown motion.motion /home/pi/motion

Try running:
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libv4l/v4l1compat.so motion -n

For me this ended up being an issue with the config file. I set the resolution to 640x360, after a bit of fiddling I found that the height had to be divisible by 16. The original error message of "port already in use" was wrong, evidenced by the fact that changing ports fixed nothing. After I switched back to a height of 480 the service came up again.
I recommend 320x240, 640x480, or 1280x720 (if you have a decent web cam and internet speeds).

Related

Raspberry PI 4 + Huawei E3372 - Send AT commands

I'm trying to send AT commands to a Huawei E3372 USB Dongle but I haven't figured out how to mount correctly.
If I do lsusb, I get the following:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 045e:00cb Microsoft Corp. Basic Optical Mouse v2.0
Bus 001 Device 003: ID 03f0:034a HP, Inc Elite Keyboard
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The dongle is listed, I can also access it's configuration screen on 192.168.1.1 and I can access internet.
I have tried creating the config file:
sudo nano /etc/usb_modeswitch.d/12d1:14db
and entered the following configuration
TargetVendor=0x12d1
TargetProduct=0x14db
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
NoDriverLoading=1
I have tried various configurations found on the web but none seems to work.
/dev/tty /dev/tty19 /dev/tty3 /dev/tty40 /dev/tty51 /dev/tty62
/dev/tty0 /dev/tty2 /dev/tty30 /dev/tty41 /dev/tty52 /dev/tty63
/dev/tty1 /dev/tty20 /dev/tty31 /dev/tty42 /dev/tty53 /dev/tty7
/dev/tty10 /dev/tty21 /dev/tty32 /dev/tty43 /dev/tty54 /dev/tty8
/dev/tty11 /dev/tty22 /dev/tty33 /dev/tty44 /dev/tty55 /dev/tty9
/dev/tty12 /dev/tty23 /dev/tty34 /dev/tty45 /dev/tty56 /dev/ttyAMA0
/dev/tty13 /dev/tty24 /dev/tty35 /dev/tty46 /dev/tty57 /dev/ttyprintk
/dev/tty14 /dev/tty25 /dev/tty36 /dev/tty47 /dev/tty58
/dev/tty15 /dev/tty26 /dev/tty37 /dev/tty48 /dev/tty59
/dev/tty16 /dev/tty27 /dev/tty38 /dev/tty49 /dev/tty6
/dev/tty17 /dev/tty28 /dev/tty39 /dev/tty5 /dev/tty60
/dev/tty18 /dev/tty29 /dev/tty4 /dev/tty50 /dev/tty61
No more luck with dmesg | grep ttyUSB that returns nothing (same for USB0, USB1,...)
It's probably something wrong in the config file but I don't see exactly what needs to be done.
Any idea ?
Thanks!
You attach wrong lsusb output. The dongle is not listed.
Perhaps the device code 14db and accessible 192.168.1.1 looks like your modem is switched to newest mode where the dongle looks like router. If you would like to send AT command then you must change mode to serial. First of all try it through:
/etc/usb_modeswitch.conf
The last part of the file contain your desired option:
HuaweiAltModeGlobal=0
Notice the comment above this option:
...you can globally set an alternative method here which provides a
different mode: either plain serial PPP...
Just try to change number. There should be around 6 modes and one of them will switch your dongle to serial mode.
Best luck.

RPi3 with SenseHat and Yocto

I am currently working with building a Yocto Image for the RPi3 with the SenseHat installed.
The Yocto image consist of the following layers:
meta
meta-poky
meta-oe
meta-networking
meta-python
meta-raspberrypi
meta-java
an application-specific layer.
The application-specific layer is mainly tasked with loading the following kernel-modules:
i2c-dev
fb_sys_fops
syscopyarea
sysfillrect
sysimgblt
rpisense_core
rpisense_js
rpisense_fb
It also contains openssh, psplash, gcc, make, libiio, rtimulib and some other misc. packages.
My image boots nicely without the SenseHat mounted, but the boot-process stops before reaching the UART shell when it is mounted. It stays frozen until the system is reset by the watchdog.
Following is the last part of the UART output before the system freezes.
{...}
Populating dev cache
ALSA: Restoring mixer settings...
/usr/sbin/alsactl: load_state:1735: No soundcards found...
Tue Nov 1 10:01:54 UTC 2016
INIT: Entering runlevel: 5
Configuring network interfaces... [ 5.130327] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
udhcpc (v1.24.1) started
Sending discover...
[ 6.662428] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
[ 6.688217] cfg80211: Calling CRDA to update world regulatory domain
Sending discover...
Sending select for 192.168.0.106...
Lease of 192.168.0.106 obtained, lease time 3600
/etc/udhcpc.d/50default: Adding DNS 192.168.0.20
/etc/udhcpc.d/50default: Adding DNS 192.168.0.40
done.
Starting system message bus: dbus.
Starting OpenBSD Secure Shell server: sshd
[ 9.034713] NET: Registered protocol family 10
done.
Starting rpcbind daemon...done.
Starting advanced power management daemon: No APM support in kernel
(failed.)
Starting bluetooth
bluetoothd
Starting syslogd/klogd: done
* Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
[ 9.401783] Bluetooth: Core ver 2.20
[ 9.405528] NET: Registered protocol family 31
[ 9.410088] Bluetooth: HCI device and connection manager initialized
[ 9.416576] Bluetooth: HCI socket layer initialized
[ 9.421576] Bluetooth: L2CAP socket layer initialized
[ 9.426747] Bluetooth: SCO socket layer initialized
...done.
Starting Telephony daemon
[ 9.507315] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 9.512765] Bluetooth: BNEP filters: protocol multicast
[ 9.518098] Bluetooth: BNEP socket layer initialized
Starting Linux NFC daemon
[ 9.624816] nfc: nfc_init: NFC Core ver 0.1
[ 9.629241] NET: Registered protocol family 39
I shoould note that I have soldered three wires onto the UART pins:
RPi3 UART pins http://www.embeddedforu.com/wp-content/uploads/2015/06/Raspberry-pi-UART-connections_thumb.png
When the system is frozen, I can still ping the device, but SSH does not work.
Any idea what might be causing this behavior?
It turned out that the problem lay within the yocto local.conf-file. The following line was set:
ENABLE_I2C = "1"
This created a second i2c-driver, which lead to one of the crashing on boot.
For any googlers out there: This flag does not need to be set. Instead make sure that the i2c-dev kernel driver is loaded at boot.
I never used the bluetooth, but it seems the system doesn't freeze, you just lose UART data when Bluetooth connects.
From here:
On the rpi3, it is normal since the BCM2837 on the Raspberry Pi3 has 2 UARTs (as did its predecessors), however to support the Bluetooth functionality the fully featured PL011 UART was moved from the header pins to the Bluetooth chip and the mini UART made available on header pins 8 & 10.
This has a number of consequences for users of the serial interface.
The /dev/ttyAMA0 previously used to access the UART now connects to Bluetooth.
I would advise you to try again having in config.txt
dtoverlay=pi3-disable-bt
enable_uart=1
And if you really need bluetooth, use
dtoverlay=pi3-miniuart-bt
And for the ssh, add "openssh" in your image recipe, and dependencies to connect like wpa-supplicant (don't forget to configure it)

HCI LE Connection -- Command Disallowed

I am using noble & bleno via node.js to connect to a BLE peripheral from Rasbian, yet something goes wrong and the connection can not be made. I tried multiple different BLE dongles and they all fail the same way. Currently I have a CSR 4.0 attached.
The connections works just fine when being made from OS X, iOS or Android.
Here is the HCI Dump:
2015-11-22 18:36:54.732907 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr 00:12:6F:6B:C7:32 type 0
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 4 max_ce 6
2015-11-22 18:36:54.734511 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x0c ncmd 1
Error: Command Disallowed
Now when I try a connection via hcitool lecc or gatttool the connection is made - yet trying to write characteristic values fails with Characteristic Write Request failed: Attribute requires authentication before read/write. Is this related?
I am on Linux raspberrypi 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux
Unfortunately even security-level high or medium didn't help.
The issue was, that I had a connection from a Central (RPi is Peripheral) and I wanted to connect to another Peripheral, which would put the RPi into Central mode. Apparently this doesn't work with BlueZ.
So I ended up with using 2 Bluetooth Dongles.
If you are looking for another OS: Mac OS X does support this though.
Also I was told that Bluetooth 4.1 Dongles might work with this.

Can't register rteth0 for FEC Ethernet card on SabreLite iMX6Q

I'm a new user on RTnet and try to make Rtnet work on Freescale Sabre Lite iMX6Q board. But I got an issue, RTnet can't use rt_fec.ko module driver to register rt_eth0 even though non real time driver is disable.
I'm using:
Linux kernel 3.0.43 download from Xenomai git://git.xenomai.org/ipipe-gch.git/?h=ipipe-3.0-imx6q
Xenomai 2.6 download from git.xenomai.org/xenomai-2.6.git/
RTnet 0.9.13 download from rtnet.org/download.html
Please see my kernel configuration and boot log in attached link.
Xenomai is loaded:
"*I-pipe: Domain Xenomai registered.
Xenomai: hal/arm started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.6.3 (Lies and Truths) loaded.
Xenomai: debug mode enabled.
Xenomai: starting native API services.
Xenomai: starting POSIX services.
Xenomai: starting RTDM services.* "
And FEC ethernet driver (non real-time driver) is loaded when kernel is booting
*"FEC Ethernet Driver
fec_enet_mii_bus: probed "*
Xenomai is built following install guideline for ARM platform from Xenomai:
http://xenomai.org/installing-xenomai-2-x/
RTnet is built by below command, because SABRE Lite use FEC ethernet card with Micrel KSZ9021 Gigabit chip so I put "--enable-fec" in configure command to build real-time driver for FEC ethernet card:
"./configure --host=armv7l-timesys-linux-gnueabi --with-rtext-config=/home/sonnguyen/rtnet-xenomai-rootfs/usr/xenomai/bin/xeno-config --with-linux=/home/sonnguyen/build/rtnet-xenomai-ipipe-imx6q --enable-rtcfg-dbg --enable-rtwlan --enable-net-routing --enable-router --enable-nomac --enable-rtcap --enable-proxy --enable-checks --enable-fec "
Then
"make DESTDIR=/home/sonnguyen/rtnet-xenomai-rootfs install"
I also changed RT_DRIVER from default value to "rt_fec" in rtnet.conf.
After kernel is booted, I ran "./rtnet start" and got this:
"RTnet: initialising real-time networking
RT FEC Ethernet Driver
./rtnet: line 385: can't create /sys/bus/pci/drivers/rt_fec/bind: nonexistent directory
initializing loopback...
RTnet: registered rtlo
RTcap: real-time capturing interface
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCGIFFLAGS: No such device
RTcfg: init real-time configuration distribution protocol
RTmac: init realtime media access control
RTmac/TDMA: init time division multiple access control mechanism
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl (add): No such device
ioctl (add): No such device
ioctl (add): No such device
ifconfig: SIOCGIFFLAGS: No such device
Waiting for all slaves...ioctl: No such device
ioctl: No such device "
Then I tried:
"# lspci
lspci: /sys/bus/pci/devices: No such file or directory
ls /sys/bus/
ac97 hid mdio_bus platform sdio spi
event_source i2c mmc scsi serio usb "
No pci directory under /sys/bus/. Then I thought because the script can't find the ethernet physical bus, it can't register rteth0.
Then I looked into rtnet script and did some minor change. In the script it requires physical ethernet device ID (mentioned in REBIND_RT_NICS), so I tried to find out what it is and got this when make eth0 up with non real-time driver:
"eth0: Freescale FEC PHY driver [Micrel KSZ9021 Gigabit PHY] (mii_bus:phy_addr=1:06, irq=-1)
PHY: 1:06 - Link is Up - 1000/Full "
I think 1:06 is my physical bus ID, then I change the code in rtnet from:
for dev in $REBIND_RT_NICS; do
if [ -d /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
done
To
echo 1:06 > /sys/bus/mdio_bus/drivers/Micrel\ KSZ9021\ Gigabit\ PHY/unbind
echo 1:06 > /sys/bus/platform/drivers/rt_fec/bind
And I tried again with "./rtnet start", this time I got this:
RTnet: initialising real-time networking
RT FEC Ethernet Driver
sh: write error: No such device
initializing loopback...
RTnet: registered rtlo
RTcap: real-time capturing interface
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCGIFFLAGS: No such device
RTcfg: init real-time configuration distribution protocol
RTmac: init realtime media access control
RTmac/TDMA: init time division multiple access control mechanism
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl (add): No such device
ioctl (add): No such device
ioctl (add): No such device
ifconfig: SIOCGIFFLAGS: No such device
Waiting for all slaves...ioctl: No such device
ioctl: No such device
But it still said "No such device"
This is lsmod after I ran ./rtnet start
lsmod
Module Size Used by Not tainted
tdma 25691 0
rtmac 9724 1 tdma
rtcfg 58071 0
rtcap 7151 0
rt_loopback 1279 2
rtpacket 6365 0
rtudp 10738 0
rt_fec 12742 0
rtipv4 29987 2 rtcfg,rtudp
rtnet 40746 9 tdma,rtmac,rtcfg,rtcap,rt_loopback,rtpacket,rtudp,rt_fec,rtipv4
./rtifconfig
rtlo Medium: Local Loopback
IP address: 127.0.0.1
UP LOOPBACK RUNNING MTU: 1500
Only rtlo is registered.
I also tried with kernel linux without non real-time FEC driver (please refer in another config file in attached Skydrive link), but still the same issue happened.
Do you have any idea how to solve this issue? I did many search but still can not figure out how to fix it.
Because I can't attach the files to my post, so I put all of my configuration files in the link below:
https://onedrive.live.com/redir?resid=162EDF85AEBD2EFE!717&authkey=!AJ1Fjd_XiohUwes&ithint=file%2czip
Best Regards,
Nguyen Hung Son

“RAM check failed” when using j-Link to erase chip or readback

I closed SWD and JTAG by acident so that I can't download new program into developboard by j-Link.Then I try using j-flash ARM to erase chip, and error comes like this:
Connecting ...
- Connecting via USB to J-Link device 0
- J-Link firmware: V1.20 (J-Link ARM V8 compiled Dec 1 2009 11:42:48)
- JTAG speed: 2000 kHz (Auto)
- Initializing CPU core (Init sequence) ...
- Executing Reset (0, 0 ms)
- Initialized successfully
- JTAG speed: 2000 kHz (Auto)
- Connected successfully
Reading entire flash chip ...
- 64 sectors, 1 range, 0x8000000 - 0x800FFFF
- ERROR: RAM check failed # address 0x20000000.
- ERROR: Write: 0x03020100 07060504
- ERROR: Read: 0xAAAAAAAA AAAAAAAA
- ERROR: (0 bytes of RAM have been checked successfully)
- ERROR: Failed to read back target memory
Disconnecting ...
- Disconnected
I don't know how to use BOOT0 and BOOT1 to get into ISP mode. BOOT0 is connected to GND.
Post some information about your environment.
Are you using IAR EWARM? If you're not, you should download the size-limited trial version. Then, load one of the basic program examples, and try to flash it to your board.
What board are you using? And what do you mean you "closed" SWD and JTAG? I'm not sure what that refers to...jumpers? options window?
Help us out here.