Bus 001 Device 008: ID 298f:1996 MACROSILICON ShadowCast |__ Port 003: Dev 008, If 0, Class=Video, Driver=uvcvideo, 480M |__ Port 003: Dev 008, If 1, Class=Video, Driver=uvcvideo, 480M |__ Port 003: Dev 008, If 2, Class=Audio, Driver=snd-usb-audio, 480M |__ Port 003: Dev 008, If 3, Class=Audio, Driver=snd-usb-audio, 480M |__ Port 003: Dev 008, If 4, Class=Human Interface Device, Driver=usbhid, 480M
user@brain:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 003: ID 413c:301a Dell Computer Corp. Dell MS116 Optical Mouse
Bus 001 Device 004: ID 04d9:a01c Holtek Semiconductor, Inc. wireless multimedia keyboard with trackball [Trust ADURA 17911]
Bus 001 Device 006: ID 0b95:772b ASIX Electronics Corp. AX88772B
Bus 001 Device 008: ID 298f:1996 MACROSILICON ShadowCast
user@brain:~$
user@brain:~$ lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=ci_hdrc/1p, 480M
|__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 001: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 002: Dev 004, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 002: Dev 004, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 003: Dev 008, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 003: Dev 008, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 003: Dev 008, If 2, Class=Audio, Driver=snd-usb-audio, 480M
|__ Port 003: Dev 008, If 3, Class=Audio, Driver=snd-usb-audio, 480M
|__ Port 003: Dev 008, If 4, Class=Human Interface Device, Driver=usbhid, 480M
|__ Port 004: Dev 006, If 0, Class=Vendor Specific Class, Driver=asix, 480M
user@brain:~$
UVCを利用できるアプリケーションとして「V4L2 Test Bench(qvv4l2)」を試してみました。
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
もし、既に最新版のhannahがはいっていた場合は、うまく入らない場合があるので、 以下のようにパッケージを削除してから再導入してみてください。 また、apt show -a で依存関係を見て、特定のバージョンに依存していて、 既にそれより高いバージョンが入っているような場合は、hannahをパッケージも削除します。
X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 1 (X_CreateWindow) Serial number of failed request: 18 Current serial number in output stream: 22
#!/usr/bin/yabasic
clear screen
print "Press 'q' to quit ..."
label again
print color("green") "Hello ";
print color("blue") "World ! ";
if (inkey$(1)="q") exit
goto again
asciitable.yab アスキーコード表示
#!/usr/bin/yabasic
for i = 32 to 47
for j = i to i + 80 step 16
s$ = chr$(j) + " "
if j = 32 s$ = "Spc"
if j = 127 s$ = "Del"
print str$(j, "#####"), ": ", s$;
next j
print
next i
gdemo.yab グラフィック表示デモ
#!/usr/bin/yabasic
w = 400
open window w, w
sleep 1
label again
backcolour 0,0,0
clear window
for i=0 to w step 5
v = 255 * i / w
color 0, v, (255 - v)
line 0, i, i, w
color (255 - v), 0, v
line i, 0, w, i
pause 0.025
next i
sleep 3
goto again
lifegame.yab ライフゲーム
#!/usr/bin/yabasic
// Game_of_Life
X = 59 : Y = 35 : H = 4
open window X*H,Y*H
backcolor 0, 0, 0
dim c(X,Y) : dim cn(X,Y) : dim cl(X,Y)
// Thunderbird methuselah
c(X/2-1,Y/3+1) = 1 : c(X/2,Y/3+1) = 1 : c(X/2+1,Y/3+1) = 1
c(X/2,Y/3+3) = 1 : c(X/2,Y/3+4) = 1 : c(X/2,Y/3+5) = 1
s = 0
repeat
clear window
alive = 0 : stable = 1
s = s + 1
for y = 0 to Y-1
for x = 0 to X-1
xm1 = mod(x-1+X, X) : xp1 = mod(x+1+X, X)
ym1 = mod(y-1+Y, Y) : yp1 = mod(y+1+Y, Y)
cn(x,y) = c(xm1,y) + c(xp1,y)
cn(x,y) = c(xm1,ym1) + c(x,ym1) + c(xp1,ym1) + cn(x,y)
cn(x,y) = c(xm1,yp1) + c(x,yp1) + c(xp1,yp1) + cn(x,y)
if c(x,y) = 1 then
if cn(x,y) < 2 or cn(x,y) > 3 then
cn(x,y) = 0
else
cn(x,y) = 1
alive = alive + 1
end if
else
if cn(x,y) = 3 then
cn(x,y) = 1
alive = alive + 1
else
cn(x,y) = 0
end if
end if
if c(x,y) then
if cn(x,y) then
if cl(x,y) color 0, 0, 255 // adult
if not cl(x,y) color 0, 255, 0 // newborn
else
if cl(x,y) color 255, 0, 0 // old
if not cl(x,y) color 255, 255, 0 // shortlived
end if
fill rect x*H,y*H,x*H+H,y*H+H
end if
next x
next y
pause 0.06
// Copy arrays
for i = 0 to X-1
for j = 0 to Y-1
if cl(i,j)<>cn(i,j) stable = 0
cl(i,j) = c(i,j)
c(i,j) = cn(i,j)
next j
next i
until(not alive or stable)
if not alive then
print "Died in ", s, " iterations"
clear window
else
print "Stabilized in ", s-2, " iterations"
end if
clock-degital.yab デジタル時計
#!/usr/bin/yabasic
clear screen
open window 300,100
backcolor 0, 0, 0
window origin "cc"
// Display digital clock
sub digital_clock()
local t$(1), void
static as$
void = token(time$, t$(), "-")
if t$(3) <> as$ then
draw_clock(t$(1), t$(2), t$(3))
as$ = t$(3)
end if
end sub
sub draw_clock(hour$, mint$, ssec$)
local d$(1), void
void = token(date$, d$(), "-")
clear window
color 200, 255, 0
text -140, -30, d$(3) + "/" + d$(2) + "/" + d$(4), ""
text 0, 0, hour$ + ":" + mint$ + ":" + ssec$, "cc", ""
end sub
if peek$("library") = "main" then
repeat
digital_clock()
until(upper$(inkey$(.01))="ESC")
exit
end if
clock-analog.yab アナログ時計
#!/usr/bin/yabasic
REM yaclock
DEG_PER_RAD = 57.257751
winx = 440
winy = 440
radius = min(winx,winy) / 2 - 1
hx = (winx/2) - 1
hy = (winy/2) - 1
REM length of the hands (90% of the radius of the clock face)
shand = int(radius * .9)
mhand = int(radius * .9)
hhand = int(radius * .5)
REM drop coords by one since graphics are 0 based
winx = winx - 1
winy = winy - 1
clear screen
open window winx,winy
clockface()
do
hour = val(mid$(time$,1,2))
mins = val(mid$(time$,4,2))
sec = val(mid$(time$,7,2))
updatehand("sec")
updatehand("mins")
updatehand("hour")
pause .25
loop
sub updatehand(hand$)
switch(hand$)
case "sec"
h_len = shand
angle = sec * 6
width = 6
color 255,0,0
ox = osx
oy = osy
oxm1 = osxm1
oxm2 = osxm2
oym1 = osym1
oym2 = osym2
break
case "mins"
h_len = mhand
angle = mins * 6 + int(sec/10)
width = 12
color 0,255,0
ox = omx
oy = omy
oxm1 = omxm1
oxm2 = omxm2
oym1 = omym1
oym2 = omym2
break
case "hour"
h_len = hhand
angle = ((hour * 30) + (minutes / 12) * 6) + int(mins/2)
width = 15
color 0,0,255
ox = ohx
oy = ohy
oxm1 = ohxm1
oxm2 = ohxm2
oym1 = ohym1
oym2 = ohym2
break
end switch
h_angle1 = angle - width
if h_angle1 < 0 then
h_angle1 = h_angle1 + 360
endif
h_angle1 = h_angle1 / DEG_PER_RAD
h_angle2 = angle + width
if h_angle2 > 360 then
h_angle2 = h_angle2 - 360
endif
h_angle2 = h_angle2 / DEG_PER_RAD
angle = angle / DEG_PER_RAD
x = (hx + (sin(angle) * h_len))
xm1 = (hx + (sin(h_angle1) * int(h_len * .2)))
xm2 = (hx + (sin(h_angle2) * int(h_len * .2)))
y = (hy - (cos(angle) * h_len))
ym1 = (hy - (cos(h_angle1) * int(h_len * .2)))
ym2 = (hy - (cos(h_angle2) * int(h_len * .2)))
clear line hx,hy,oxm1,oym1
clear line hx,hy,oxm2,oym2
clear line oxm1,oym1,ox,oy
clear line oxm2,oym2,ox,oy
line hx,hy,xm1,ym1
line hx,hy,xm2,ym2
line xm1,ym1,x,y
line xm2,ym2,x,y
REM save off the old vals
switch(hand$)
case "sec"
osx = x
osy = y
osxm1 = xm1
osxm2 = xm2
osym1 = ym1
osym2 = ym2
break
case "mins"
omx = x
omy = y
omxm1 = xm1
omxm2 = xm2
omym1 = ym1
omym2 = ym2
break
case "hour"
ohx = x
ohy = y
ohxm1 = xm1
ohxm2 = xm2
ohym1 = ym1
ohym2 = ym2
break
end switch
end sub
sub clockface()
circle hx,hy,radius
htick = radius / 10
mtick = htick / 2
for z=0 to 360 step 6
REM Begin at zero deg and stop before 360 deg
REM draw the hour markers
angle = z
angle = angle / DEG_PER_RAD
x2 = (hx + (sin(angle) * radius))
y2 = (hy - (cos(angle) * radius))
if mod(z,30) = 0 then
tick = htick
else
tick = mtick
endif
x3 = (hx + (sin(angle) * (radius - tick)))
y3 = (hy - (cos(angle) * (radius - tick)))
color 255,0,0
line x2,y2,x3,y3
color 0,0,0
next z
end sub
Mandelbrot.yab マンデルブロート集合描画
#!/usr/bin/yabasic
open window 640, 400
wid = 4
xcenter = -1: ycenter = 0
ms = 0
for xcoord = 0 to 639
for ycoord = 0 to 200
ms = 0
ca =(xcoord-320)/640*wid+xcenter
cb =(ycoord-200)/640*wid+ycenter
x = 0: y=0
for t = 1 to 20
xnew = x*x-y*y+ca
ynew = 2*x*y+cb
x=xnew:y=ynew
magnitudesquared=x*x+y*y
ms = magnitudesquared
if (magnitudesquared > 100) break
//if(magnitudesquared < 100) then : color 0,0,0 : dot xcoord, ycoord : end if
next t
ms = ms+1
if(ms > 250) then
color 32,64,mod(ms,255)
dot xcoord, ycoord
dot xcoord, 400- ycoord
elseif (ms > 150) then
color mod(ms,255),64,32
dot xcoord, ycoord
dot xcoord, 400-ycoord
else
color 0,0,0
dot xcoord, ycoord
dot xcoord, 400-ycoord
end if
next ycoord
next xcoord