Prisijungti

Telefono WebCam'as Linuxe

TechtronicMindaugas N.
  • 30 Bal '13

Temos pradzia viewtopic.php?f=2&t=8788

Kaip jau ir rasiau, tai yra sudetinga, ir tema jau nera skirta pradedantiesiems.

Mums reikia v4l2loopback linux kernelio modulio kurti V4L2 loopback devices. Atsisiusti ir sukompiliuoti si moduli reikia tureti ir Linux sources.

mkdir -p ~/Projects
cd ~/Projects
git clone git://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback
sudo make

Jeigu be klaidu, tai rasime faila v4l2loopback.ko

file v4l2loopback.ko
v4l2loopback.ko: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), BuildID[sha1]=eb3fe89f21339daf3bd87076b9a7f39f6a7dd15b, not stripped

Visi parametrai sio modulio:

modinfo v4l2loopback.ko

filename: /home/minde/Projects/v4l2loopback/v4l2loopback.ko
license: GPL
author: Vasily Levin, IOhannes m zmoelnig zmoelnig@iem.at,Stefan Diewald,Anton Novikov
description: V4L2 loopback video device
depends: videodev
vermagic: 3.6.11-gentoo SMP mod_unload 586
parm: debug:debugging level (higher values == more verbose) (int)
parm: max_buffers:how many buffers should be allocated (int)
parm: max_openers:how many users can open loopback device (int)
parm: devices:how many devices should be created (int)
parm: video_nr:video device numbers (-1=auto, 0=/dev/video0, etc.) (array of int)
parm: max_width:maximum frame width (int)
parm: max_height:maximum frame height (int)

Dabar galime load ji (+videodev moduli)

sudo modprobe videodev
sudo insmod v4l2loopback.ko video_nr=1,2 debug=9

Tokiu budu sukursime ne viena device, o dvi bei matysime debug output (dmesg).

ls /dev/video*
├crw─rw────┤root:video│43 year│81B│/dev/video1
├crw─rw────┤root:video│43 year│81B│/dev/video2

Toliau mums reikia telefono (DAMN! )
As naudoju N900, sukuriu nauja interface ir init skripta.
init skripte butina panaudoti sias komandas:

iptables -A POSTROUTING -t nat -s 192.168.2.15/32 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

Na ir aisku udev rules, kad pajungus telefona mums Linux pasirinktu tinkamus modulius

cat /etc/udev/rules.d/99-nokia-n900.rules 
SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_ether", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="n900"

Kad butu lengviau atrasti MODEL galima naudoti udevadm monitor

udevadm monitor --kernel

Toliau reloadinam udev rules

udevadm control --reload-rules

Nustatom tinkamai interface, as ja uzvadinau n900

config_n900="192.168.2.14 netmask 255.255.255.0 broadcast 192.168.2.14"

Dabar telefonas tures savo IP adresa 192.168.2.15
Paleidziame sia interface

sudo /etc/init.d/net.n900 start

Ir patikrinam ar ji atsirado

sudo ifconfig n900
n900: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.14  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::f81f:5ff:fefc:9a62  prefixlen 64  scopeid 0x20<link>
        ether fa:1f:05:fc:9a:62  txqueuelen 1000  (Ethernet)
        RX packets 86  bytes 3668 (3.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 59  bytes 7657 (7.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Dabar laikas telefona hackinti. Jums reikia tureti root teises ir openssh.

Telefone sukuriau skripta net.sh

#!/bin/sh
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
ifdown usb0
sleep 2
ifup usb0
route del default
route add default gw 192.168.2.14
run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0
# Google DNS
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
/etc/init.d/ssh start

Ir pakeiciau /usr/sbin/pcsuite-enable.sh faila, kuri paleidzia tada kai telefonas pajungiamas kaip pc-suite.

/bin/sh /root/net.sh

Pajungus telefona prie PC ir pasirinkus "pc-suite" mums paleis ta skripta ir kartu openssh, na ir aisku nustatys tinkamai telefono interface.
Veiks kaip router, tik atvirksciai
Dabar is PC galime jungtis i telefona per ssh:

TERM="xterm" ssh root@192.168.2.15            
The authenticity of host '192.168.2.15 (192.168.2.15)' can't be established.
RSA key fingerprint is 6d:f7:27:d7:e4:7e:07:ea:ac:7f:8b:b4:0d:5f:1f:23.
Are you sure you want to continue connecting (yes/no)? 
root@192.168.2.15's password: 
BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso31+0cssu0) built-in shell (ash)
Enter 'help' for a list of built-in commands.

Patikrinam ar veikia internetas:

┌─[✗]─[Nokia-N900]─[~]
└──╼ ping google.lt
PING google.lt (173.194.70.94): 56 data bytes
64 bytes from 173.194.70.94: seq=0 ttl=47 time=34.271 ms
64 bytes from 173.194.70.94: seq=1 ttl=47 time=33.722 ms
64 bytes from 173.194.70.94: seq=2 ttl=47 time=34.332 ms
64 bytes from 173.194.70.94: seq=3 ttl=47 time=33.936 ms
64 bytes from 173.194.70.94: seq=4 ttl=47 time=33.508 ms

Toliau mums reikes Gstreamer su pluginais. Sukuriam dar viena skripta pavadinimu cam.sh

#!/bin/sh -x
# galima /dev/video0 arba /dev/video1
DEVICE="/dev/video0"
HOST="192.168.2.14"
PORT="5000"
WIDTH="640"
HEIGHT="480"
gst-launch v4l2camsrc device=$DEVICE ! videoscale ! video/x-raw-yuv,width=$WIDTH,height=$HEIGHT ! ffmpegcolorspace ! jpegenc ! multipartmux ! tcpserversink host=$HOST port=$PORT

chmod +x ji, ir paleidziame. Is PC galime jau matyti savo cam

vlc tcp://192.168.2.15:5000

Jeigu taip ir yra, tai svekinu.

Kaip panaudoti su Skypu ar Mplayer rasite siame wiki: https://github.com/umlaeute/v4l2loopback/wiki .

Kokybe tikrai gera, nors n900 turi ne kokia kamera. Patarciau palikti 640x480, bus kiek blogesne kokybe, bet Skypu maziau lagins. Gal dar reiktu kiek pazaisti su gst-launch komanda, bet jau ir taip rezultatas yra...

http://i.imgur.com/iXCYV1Y.png

  • 19 Lap '13

Gal autorius nesupyks, bet naujokams ar tiems kas nemėgsta sudėtingų dalykų siūlau išbandyti http://androidas.net/ip-webcam-naudokite-android-telefona-kaip-belaide-kamera/. Tai android telefonų turėtojams skirta programėlė, kurios pagalba lengvai periusite vaizdą į kompiuterį.

  • 15 Lie

Can You Puchase Prochlorperazine Online Bloorymymn [url=https://ascialis.com/#]cialis without prescription[/url] tisindtriery Venta Cialis Original ordeNe <a href=https://ascialis.com/#>cialis buy online usa</a> Paileillenny Medrol Dose Pack 4 Mg No Rx

  • 3 Rugs

canadian pharmacy meds <a href=http://canadian4pharmacy.com/#>legit online canadian pharmacy</a> medicine usa

  • 14 Rugs

security finance: http://www.quicken4loans.com payday loans bourse finance
1500 dollar payday loan

  • 15 Rugs

health risks from using fixodent denture adhesive http://withoutdrprescriptions.com – online doctor viagra http med [url=https://withoutdrprescriptions.com/]over the counter viagra cvs[/url] dysfunction treatment

  • 16 Rugs

sba disaster loan application installment loans: http://www.loansonline1.com/# finance news [url=http://www.loansonline1.com/#]fast payday loan[/url] coronavirus small business loan

  • 16 Rugs

bypass e viagra very cheap cialis [url=http://try4ed.com/]generic cialis[/url] viagra email my yahoo account http://try4ed.com/ san francisco public health department human resources fmla paperwork

  • 19 Rugs

cash advance online: http://loanssl.com online loans cash express
eidl loan

  • 20 Rugs

online medicine http://cialiswalmart5.com generic cialis
bula cialis lilly [url=https://cialiswalmart5.com/]cialis costs at walmart[/url] inexpensive health insurance plans

  • 20 Rugs

cialis 3 days
https://www.tadalafil5walmart.com cialis over the counter at walmart

  • 25 Rugs

Wow quite a lot of wonderful tips.
[url=https://withoutxep.com]buy viagra without seeing doctor[/url]
viagra good diabetic https://withoutxep.com viagra no prescription

  • 26 Rugs

Our doctor contemplation that Dad was as the case may be the same improve than Mom in this situation. Stricter, more demanding, choice not be remorseful over once again when you beggary to go over bad https://www.lenkaed.com viagra online. Well, I wanted to transmit my wife a break.
I burnt- a little on top of a month in the exhaustive care component and two and a half months in the bone marrow resettle unit. There I became a benefactress representing my son. I'm glad I was able to relieve him. I was the not humankind in both departments, but my parents were already there. That is, a fetters in the avert with a sprog is no longer a rarity. Some mothers were surprised through my level-headedness and said that it would be difficult on me. I did not be aware why it is not difficult in search my mother, and it should be troubling <a href="https://www.lenkaed.com">viagra pills</a>. It's not easier for teams. Especially those who have only recently highbrow about the child's diagnosis.

  • 26 Rugs

find the doctor http://canadianpharmaus.com pain meds online without doctor prescription
canada pharmacy <a href="http://canadianpharmaus.com/">top rated canadian pharmacies online</a> drugs rx list

  • 29 Rugs

<a href="http://viagrabun.com">viagra</a>
viagra vision https://viagrabun.com/# viagra generic

  • 1 Spa

<a href=https://viagra4generic.com>generic viagra online canadian pharmacy</a>
<a href="https://viagra4generic.com/#">viagra online</a>

  • 2 Spa

UPD 24.09.2020: aids for stroke victims http://good4ed.com/# viagra online precio oficial viagra en farmacia <a href="http://good4ed.com/">generic brand viagra</a> salary medical doctor

  • 3 Spa

doctor's office http://finasteride5.com propecia medicine in india
<a href="http://finasteride5.com">propecia australia price</a>

  • 3 Spa

affordable health insurance for individuals https://viagra4generic.com how long does cialis 2.5mg last
<a href=https://viagra4generic.com/#>buy viagra</a> cheap family health insurance plans

Atsakyti