2023,江端さんの忘備録

子どものあこがれの職業に「会社員」というのが、ランクインしているそうです。

The "company employee" ranks high on the list of occupations that children long to have.

コロナ禍のリモートワークで、親の働いている姿を見ることによって、子どもたちの「会社員」の実態が見えたから、という分析がされています。

The analysis was based on the fact that remote work during the Corona disaster allowed the children to see what it was like to be a "company employee" by watching their parents work. That means,

―― 仕事している親は、かっこいい

-- Parents who work are cool

ということのようです。

難しいビジネス用語を使って、真剣に議論をして、英語を使って会話を試みている親は、自宅にいる親とは異なる、「もう一人の別の親の顔」と言えましょう。

A parent using difficult business terms, having serious discussions, and attempting to converse in English is "another parent" different from the parent at home.

これは、子どもに向けた、リアル社会への窓口であり、社会への憧れと、同時に、社会の厳しさや恐怖も伝えていると思います。

I believe this is a window to the real society for children, conveying their yearning for society and, at the same time, the harshness and fear of society.

-----

私、下請けの木工家具の会社の社長令息 ―― といえば聞こえばいいですが、

I was the son of the president of a subcontracted wood furniture company -- that sounds good,

私は、体に悪いシンナー型のガスが充満した、サウナと同じ温度の工場の中で、人力だけで巨大な特注家具を運搬する父と母の姿を見つづけてきました。

I have watched my father and mother hauling massive custom-made furniture by human power alone in a factory filled with toxic thinner-type gases, the same temperature as a sauna.

時々は、手伝いにも行きました。

From time to time, I also went to help out.

ティーンエイジャであった私ですら、工場で倒れかねないほど、本当にキツい仕事でした。

It was an adamant site, so tough that even I, a teenager, could have collapsed in the factory.

高齢だった父や母の疲労や苦痛を考えると、言葉になりません。

There are no words to describe the fatigue and pain of my father and mother, who were elderly.

それでも、生活は裕福とは言えず、そのような父や母の姿を見ながら、私は、親に「お金」(学費)について相談することもできなくなってきました。

Still, life was not well-off, and seeing my father and mother in such a state, I could no longer talk to my parents about "money" (school fees).

親の仕事のリアルを見てきた私は、「親への敬意と感謝」と「努力しているものが正当に報われない社会への憎悪」の両方を持ちながら、今に至っています。

Having seen the realities of my parents' work, I have come to have both respect and gratitude for them and hatred for a society that does not fairly reward those who work hard.

-----

ともあれ、子どもが、『仕事している親は、かっこいい』と思える社会は、良い社会です。

A society in which children think, "Parents who work are cool," is a good society.

これは、コロナ禍がもたらした数少ないメリットの中でも、最大級のメリット、と思っています。

This is one of the few benefits that the Corona Disaster has brought, and I believe, one of the greatest.

これからは、『リモートワークで腹芸ができてこそ、一流の政治家であり、官僚である』という時代にしていかなければなりません。

2023,江端さんの忘備録

『何かを始める前に人に相談する』というのは、『悪手』だなぁ、と思います。

It is a 'bad idea' to 'consult with others before starting something.'

自分より専門知識を持つ人に相談することにはリスクもリターンもありますが、専門知識を持たない人に相談するのは、最悪です。

There are risks and rewards in consulting with someone with more expertise than you, but consulting with someone without knowledge is a terrible idea.

なぜなら、

Because,

(1)相談された人は『いいね』を言うだけでは足りないと考えて、色々批評をしなければならないと思ってしまい、

(1) The person who was consulted thought it was not enough to say 'good,' and he/she tends to give a lot of reviews,

(2)批評を受けた人は、それを「批判」または「非難」と取らえてしまい、

(2) The person receiving the review tends to take it as "criticism" or "condemnation,

Win-Win ではなく、Lost-Lost の関係になってしまうからです。

This is not a "Win-Win" but a "Lost-Lost."

-----

本人の器量にも因ると思いますが、やはり私は、

I guess it depends on the caliber of the person, but I still think

「世界は一人で動かす」

"I run the world alone."

がいいです。

It is good for me.

「夢を語る子どもにとって、全ての大人は敵である」

2023,江端さんの忘備録

今週末、『もう動くだろう』と高を括っていたコードが動かなくて、丸1日半の時間が溶けました。

This weekend, a whole day and a half of my time melted away because the code I was so high on, 'it will work now,' didn't work.

しかも、今も動いていない。

And it is still not working.

最近は、朝、起きると、長いToDoリストが頭の中を流れて、それだけで憂鬱(ゆううつ)になっています。

Lately, when I wake up in the morning, a long to-do list flows through my head, and that alone is enough to make me feel depressed.

そんな中の、1.5日というのは、本当に辛い。

In such a situation, 1.5 days is tough.

-----

世の中には、(A)時間をかければ何とかなるものと、(B)時間をかけても何ともならないものがあります。

There are two things in the world: (a) things that can be worked out over time and (b) things that are nothing to be worked out over time.

で、上記(B)の中には、自分の努力とは無関係の理由で、何ともならないものがあり、それが、プログラミングやシステムだったりします。

So, some of the above (b) will not happen for reasons unrelated to your efforts. Programming and systems are that.

コラムは時間をかければ、ネタが出てきます。

Columns will come up with stories if you give them time.

特許やペーパーも何とかできます。

I can also manage patents and papers.

少なくとも、時間を見積ることができます。

At the very least, I can estimate the time.

しかし、プログラムとシステムだけは、本当に、どこでハマるか予測できないのです。

But only programs and systems can't predict where I will get stuck.

-----

という訳で、この週末は、ひたすら辛く、暗かったです。

So, this weekend was just hard and dark.

明日からの仕事の目処もつかず、非常に気が重いです。

I am very depressed because I have no idea what to work tomorrow.

『自分で頑張るのも、ほどほどにしておかなければ』ということですね。

2023,江端さんの忘備録

NHKのダークサイドミステリ「悪魔はいた!? 世界衝撃のエクソシスト裁判?誰が少女を殺したのか?~」を見ていました。

I watched the NHK program, dark side mystery "The Devil Was There! The World Shocking Exorcist Trial? Who Killed the Girl? ~".

その番組の中でコメンテータが、アウシュビッツの話を語っていました。

A commentator on that program talked about Auschwitz.

それを聞いて思い出したことがりました。

This reminded me of something.

小学生の頃、教師がナチス政策の一つである、いわゆる『ユダヤ人問題の最終解決』の話をしかけた時、

When I was in elementary school, a teacher was about to talk about one of the Nazi policies, the so-called "Final Solution of the Jewish Question" She said to me,

『うーん、これについては、江端君の方が上手く説明できそうですね。頼めますか?』

'Hmmm, I think Ebata-kun can explain this better than I can. Can you do it?'

と、小学4年生の私に、この話の解説をふりました。

At this time, I was in the fourth grade.

-----

実際に、私の方が詳しかったです。

I was more familiar with this kind of thing.

殺害された人物の数について、当時の私たちの街の人口数を出して、そのスケール感を説明するなど、小学生としては、まずまずの説明ができたと思います。

I explained the scale of the number of people killed by giving the population numbers of our city at the time. For an elementary school student, I think I did an excellent job of explaining it.

-----

ただ、

However,

世界の(日本も含む)虐殺史に精通した小学生 ―― これは子どもはもちろん、大人から見ても『嫌な小学生だったろうな』と思います。

An elementary school student familiar with the history of the world's (including Japan's) genocide -- This must have been a 'disgusting elementary school student,' not only from a child's point of view but also from an adult's point of view.

私のティーンエイジャ時代に「明るい」とか「楽しい」とかの記憶が少ないのは、仕方がなかったのかもしれない、と思い返しています。

I think back to my teenage years and recall that it may have been inevitable that I have few memories of "cheerful" or "fun" times.

―― 江端さんって、ナチズムの信奉者なのですか?

 

2023,江端さんの忘備録

―― まさか、今さら警察当局から削除命令受けるとは思わなかった

昨日のブログを見なおして、改めて思ったのですが。

I was thinking about this again after reviewing yesterday's blog.

私の、「やさしい水素爆弾の作り方」が当局から削除命令を受けるのであれば、

If my, "How to build a hydrogen bomb the easy way" is ordered to be deleted by the authorities,

コミック&アニメの「Dr.STONE」は、発行禁止命令が出てもいいんじゃないか、と思うんですけどね。

I think the comic & animated "Dr. Stone" should have a no-publication order.

―― "Dr STONE"というアニメが面白い

もっとも、本当にそんな命令が出たら、私は命令の無効の訴えの原告団に入るつもりはありますが。

However, if such an order is indeed issued, I would join the plaintiffs in an action to invalidate the order.

-----

というか、爆発物の製造について記載されているコミックなんて、私、思いつくだけでも、5つは挙げられます。

I mean, I can name five comics that describe the manufacture of explosives, just in my memory.

ただ、それらの本は、原料は記載されていても、配合率とか、製造プロセスが、具体的に記載されていないので、セーフになっているのかもしれません。

However, those books may be safe because they list the ingredients, but do not specifically describe the ratio of ingredients or the manufacturing process.

確かに、数字の入っていない爆発物マニュアルなんて、全く役に立ちませんから。

Certainly, an explosives manual without numbers in it would be completely useless.

2023,江端さんの忘備録

私の代表作のコラムといえば、「やさしい水素爆弾の作り方」でしょう。

One of my best-known columns is "How to Build a Gentle Hydrogen Bomb."

このコラムは、塾の講師であった私が、小学生の子どもと一緒に、食塩水を電気分解して発生した水素の燃焼実験の様子を、コミカルに記載したものです。

This column is a comical description of a combustion experiment in which I, as a cram school instructor, worked with elementary school children on hydrogen combustion generated by the electrolysis of brine solution.

言うまでもありませんが、単なる化学反応の話が記載されているだけで、核融合反応の話など1mmも出てきません。

Mere chemical reactions are described, and fusion reaction is not mentioned.

そもそもこのコラムをWebにアップしたのは、1996年 ―― 27年前です。

I first posted this column on the Web in 1996, 27 years ago.

―― まさか、今さら警察当局から削除命令受けるとは思わなかった

-- I didn't think I'd get an order to delete it from the police authorities now.

―― でもって、まさか、プロバイダから『命令に応じない場合は、サービスを停止する』と宣言されるとは思わなかった

-- But then, I didn't expect the provider to declare, 'If you don't comply with the order, we will suspend your service.

-----

どう考えても、私のこのコラムの出版権(Web掲載権)の侵害です。

This infringes my right to publish this column (right to post on the Web).

そもそも、警察にどうこう言われる内容ではないことも明らかです。

In the first place, it is also clear that this is not what the police have to say about the matter.

さらに、コンテンツに問題があったとしても、法律制定前の記載であれば、「法の不遡及の原則」から鑑みて、この命令自体が逆に違法行為に問われます。

Furthermore, even if there were problems with the content, if the statements were made before the law was enacted, the order itself would be charged with illegal acts, given the "principle of non-retroactivity of the law" to the contrary.

ただ、今回の警察の命令に記載されていた、『爆発物取締罰則』という内容が気になって調べてみました。

However, I was curious about the "Explosives Control Penalties" listed in this police order and looked into it.

「明治十七年太政官布告第三十二号(爆発物取締罰則)」という恐ろしく古い法律が根拠条文のようです(この場合、「法の不遡及の原則」では抗弁できません)。

It seems that the basis of the law is an old law called "Dajokan Houmu No. 32 (Explosives Control Penal Provisions) of 1884" (in this case, the "principle of non-retroactivity of law" cannot be used as a defense).

カタカナで記載されている条文で読みにくかったのですが、私は、第1条の『治安ヲ妨ケ又ハ人ノ身体財産ヲ害セントスルノ目的ヲ以テ爆発物ヲ使用シタル者及ヒ人ヲシテ之ヲ使用セシメタル者』の主体に該当しないので、この法律自体の適用がおかしい。

It wasn't easy to read the article because it was written in Katakana. Still, I do not fall under Article 1, "Persons who use explosives to disturb public order or harm human life or property, and persons who use explosives to harm human life or property." Hence, the application of this law itself is not correct.

ただし、この条文については、最高裁の判断として、

However, the Supreme Court's decision on this article, i interpreted as follows,

「理化学上の爆発現象を惹起するような不安定な平衡状態において、薬品その他の資材が結合する物体であって、その爆発作用そのものによって公共の安全をみだし、または人の身体財産を害するに足る破壊力を有するもの」(最判昭和31年6月27日刑集第10巻6号921頁)

"An object in which chemicals and other materials are combined in an unstable equilibrium state that causes physical and chemical explosive phenomena, and the explosive action itself has sufficient destructive power to endanger public safety or damage human bodies and property" (June 27, 1956, Penal Code, Vol. 10, No. 6, p. 921).

という解釈がされています。

まあ、普通に考えて、故意または過失、という要件が必要になるとは思いますが、そうだとしても法律の対象が「製造者」になるのは言うまでもありません。

Well, I think the usual requirement of intent or negligence would be necessary, but even if that were the case, it goes without saying that the law would cover the "manufacturer."

つまり、警察当局は『私が、法律の素人だと思って、このような警告をしてきた』のだろう、と推認されます。

In other words, it can be inferred that the police authorities thought I was a layman in the law and gave me this warning.

-----

これについて、『当局とバトルして、その様子をブログに連載にするのはどうかな? 』とも思ったのですが、正直

I thought, 'Why don't I battle with the authorities about this and write a series of blog posts about it? But, to be honest, I thought

―― 面倒くさい

"That's a pain in the ass."

と、思いました。

それと、『この実験を、安易に子どもがマネするかもしれない』という危惧は、いつでもありました。

And there was always the fear that 'children might easily copy this experiment.

だからこそ、この実験の危険性については、コラムの中で山ほど記載していたのですが、子どもというのは「やるときにはやる」ものです。

That is why I have described the dangers of this experiment so much in my column, but children are "doers when they do it."

そして、これで事故が発生して、私の名前が予想せぬ形で全国に知れ渡るのは、私も嫌です。

And I would hate for this to cause an accident and for my name to be known all over the country unexpectedly.

-----

色々考えた結果、今回、私は、コンテンツの削除に応じることにしました。

After much consideration, I have decided to respond to the removal of the content.

―― 江端が、当局(権力)に対して日和った

"Ebata waited and saw and was assigned against the authorities (power)."

と、大いに吹聴して下さい ―― というか、今さらですが、私(江端)は、常日頃から日和っています。

And please blow it up a lot -- I mean, it's a little late for that, but I (Ebata) have always waited and saw.

権力どころか、社内のチームリーダーにさえ、日和っています。

Not only for power but also as a research teams reader in my company

2023,江端さんの技術メモ

WSLのバージョンが"1"だったので"2"に変えようとしたら、ちょっと酷い目にあった件

を経て、再度、wsl で USBのWebカメラを使うに、挑戦中。

ちなみにターゲットのカメラはこちら(ロジクール Webカメラ C270n HD 720P)です。

ちなみに前提として、https://github.com/dorssel/usbipd-win/releases から、usbipd-win_3.0.0.msiをダウンードしてWIndows10に入れています。

とりあえずWindows10(×11)の、powershell(管理者モード)で、以下を確認

PS C:\WINDOWS\system32> wsl --list --all --verbose
NAME STATE VERSION
* docker-desktop-data Stopped 2
Ubuntu-20.04 Running 2
docker-desktop Stopped 2

という、いわゆる「オール2」をなんとか実現。

PS C:\WINDOWS\system32> usbipd wsl list
BUSID VID:PID DEVICE STATE
4-1 1058:25a2 USB 大容量記憶装置 Not attached
4-2 04bb:011c USB 大容量記憶装置 Not attached
5-3 04d9:1400 USB 入力デバイス Not attached
6-1 0d8a:0103 USB 印刷サポート Not attached
6-3 093a:2510 USB 入力デバイス Not attached
7-2 04f9:02c0 USB 印刷サポート, Brother DCP-J940N, USB 大容量記憶装置 Not attached
8-1 0a12:0001 Generic Bluetooth Radio Not attached
8-2 0d8c:0139 USB PnP Sound Device, USB 入力デバイス Not attached
8-3 046d:0825 Logi C270 HD WebCam Not attached
8-4 04e6:511a SCR3310-NTTCom USB SmartCard Reader Not attached

までは、なんとか出てくるのだけど、

PS C:\WINDOWS\system32> usbipd wsl attach --busid 8-3
usbipd: info: Using default WSL distribution 'docker-desktop-data'; specify the '--distribution' option to select a different one.
usbipd: error: The selected WSL distribution is not running; keep a command prompt to the distribution open to leave it running.

このエラーが取れない(いまいましい)。

https://github.com/dorssel/usbipd-win/issues/136 のページを読んでいたら、ちょっと気になった一節があったので、これを試してみました。

PS C:\WINDOWS\system32> usbipd wsl attach --distribution Ubuntu-20.04 --busid 8-3

としたら、何も言わずに、「通し」ました。

通らない場合もありました。

usbipd: error: The service is currently not running; a reboot should fix that.

というエラーがでてきて困りました。

この場合、管理者モードで立ち上げたpowershellから、

usbipd server

を投入しつつ、別の管理者モードでpowershellから、"usbipd wsl attach --distribution Ubuntu-20.04 --busid 8-3" を実施すると上手くみたいです(powershellが2つも上がっている状態はうっとうしですが)

BUSID VID:PID DEVICE STATE
4-1 1058:25a2 USB 大容量記憶装置 Not attached
4-2 04bb:011c USB 大容量記憶装置 Not attached
5-3 04d9:1400 USB 入力デバイス Not attached
6-1 0d8a:0103 USB 印刷サポート Not attached
6-3 093a:2510 USB 入力デバイス Not attached
7-2 04f9:02c0 USB 印刷サポート, Brother DCP-J940N, USB 大容量記憶装置 Not attached
8-1 0a12:0001 Generic Bluetooth Radio Not attached
8-2 0d8c:0139 USB PnP Sound Device, USB 入力デバイス Not attached
8-3 046d:0825 Logi C270 HD WebCam Attached - Ubuntu-20.04
8-4 04e6:511a SCR3310-NTTCom USB SmartCard Reader Not attached

おお、通ったようだ ―― では、ここからどうすればいいだっけ?

WSLからlsusbを実行し、接続されているUSBデバイスをリストアップすると、ッデバイスが見えるようになっていました。

ebata@DESKTOP-P6KREM0:/dev$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ここから先は、

WSL2 USBカメラ+他のUSB機器 2022年09月06日版

を参照。

私の環境でも、

ebata@DESKTOP-P6KREM0:/dev$ ls -l /dev/video
ls: cannot access '/dev/video': No such file or directory

となったので、Linuxカーネルをカスタムビルド に入る準備が整ったのだろう。憂鬱だ。カーネルのビルドと聞くだけで、おぞましい記憶が蘇えってくるから

と、泣き言をいってもしかたがないので、

https://github.com/PINTO0309/wsl2_linux_kernel_usbcam_enable_conf

に突っ込むこととする。

On WSL2.

ebata@DESKTOP-P6KREM0:~$ uname -r -v
5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023

幸い、ページの内容と同じのようだ。

On Windows Terminal.

PS C:\WINDOWS\system32> wsl --update
更新プログラムを確認しています。
Linux 用 Windows サブシステムの最新バージョンは既にインストールされています。
PS C:\WINDOWS\system32> wsl --shutdown

で、

PS C:\WINDOWS\system32> wsl --install -d Ubuntu-20.04
Ubuntu 20.04 LTS は既にインストールされています。
Ubuntu 20.04 LTS を起動しています...

で、
On WSL2

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata$ uname -r -v
5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023

で、

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata$ sudo apt update && sudo apt upgrade -y
[sudo] password for ebata:
Hit:1 http://ppa.launchpad.net/longsleep/golang-backports/ubuntu focal InRelease
(中略)
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

で、

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata$ sudo apt install -y build-essential flex bison libgtk-3-dev libelf-dev libncurses-dev autoconf libudev-dev libtool zip unzip v4l-utils libssl-dev python3-pip cmake git iputils-ping net-tools dwarves guvcview python-is-python3 bc
Reading package lists... Done

(中略)

Processing triggers for install-info (6.7.0.dfsg.2-5) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...

で、

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata$ cd /usr/src
ebata@DESKTOP-P6KREM0:/usr/src$ TAGVERNUM=5.15.90.1 && TAGVER=linux-msft-wsl-${TAGVERNUM} && WINUSERNAME=ebata
ebata@DESKTOP-P6KREM0:/usr/src$ sudo git clone --depth 1 -b ${TAGVER} https://github.com/microsoft/WSL2-Linux-Kernel.git ${TAGVERNUM}-microsoft-standard && cd ${TAGVERNUM}-microsoft-standard
Cloning into '5.15.90.1-microsoft-standard'...

(中略)

Updating files: 100% (73704/73704), done.

で、

ebata@DESKTOP-P6KREM0:/usr/src/5.15.90.1-microsoft-standard$ sudo wget -O .config https://github.com/PINTO0309/wsl2_linux_kernel_usbcam_enable_conf/raw/main/${TAGVER}/config-${WSL_DISTRO_NAME} && sudo chmod 777 .config && sudo make clean
--2023-06-08 23:52:43-- https://github.com/PINTO0309/wsl2_linux_kernel_usbcam_enable_conf/raw/main/linux-msft-wsl-5.15.90.1/config-Ubuntu-20.04
(中略)

2023-06-08 23:52:44 (11.3 MB/s) - ‘.config’ saved [123800/123800]

で、ここからが、本格的なカーネルコンパイルのようで、相当時間がかかった。パスワードを1回聞かれました

ebata@DESKTOP-P6KREM0:/usr/src/5.15.90.1-microsoft-standard$ sudo make -j$(nproc) KCONFIG_CONFIG=.config && sudo make modules_install -j$(nproc) && sudo make install -j$(nproc)
SYNC include/config/auto.conf.cmd

(中略)

BUILD arch/x86/boot/bzImage
Kernel: arch/x86/boot/bzImage is ready (#1)
[sudo] password for ebata:
arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support

(中略)

I: /boot/initrd.img is now a symlink to initrd.img-5.15.90.1-microsoft-standard-WSL2+

で、

ebata@DESKTOP-P6KREM0:/usr/src/5.15.90.1-microsoft-standard$ sudo rm /mnt/c/Users/${WINUSERNAME}/vmlinux
rm: cannot remove '/mnt/c/Users/ebata/vmlinux': No such file or directory

(ここで初めてエラーになった。で、実際に、vmlinuxがなかったので、このままにして次に進んだ)

ebata@DESKTOP-P6KREM0:/usr/src/5.15.90.1-microsoft-standard$ sudo cp /usr/src/${TAGVERNUM}-microsoft-standard/vmlinux /mnt/c/Users/${WINUSERNAME}/

で、

ebata@DESKTOP-P6KREM0:/usr/src/5.15.90.1-microsoft-standard$ cat << 'EOT' > /mnt/c/Users/${WINUSERNAME}/.wslconfig
> [wsl2]
> kernel=C:\\Users\\ebata\\vmlinux
> EOT

で、

On Windows Terminal. (新しいターミナルから)

PS C:\WINDOWS\system32> wsl --shutdown

On WSL2。ビルドされたカーネルが正常にロードされた場合、カーネル名の末尾に+が表示されます。#nはカーネルがビルドされた回数です。

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata$ uname -r -v
5.15.90.1-microsoft-standard-WSL2+ #1 SMP Thu Jun 8 23:54:50 JST 2023

で、 On WSL2.で

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata$ cd /usr/src

ebata@DESKTOP-P6KREM0:/usr/src$ TAGVERNUM=6.1.21.2

ここの6.1.21.2は、

https://github.com/microsoft/WSL2-Linux-Kernel/tags

にあった最新のものを適当に入れた(知らん)。

On WSL2.

ebata@DESKTOP-P6KREM0:/usr/src$ sudo git clone -b ${TAGVER} https://github.com/microsoft/WSL2-Linux-Kernel.git ${TAGVERNUM}-microsoft-standard && cd ${TAGVERNUM}-microsoft-standard

で、これが結構長かった。

で、

ebata@DESKTOP-P6KREM0:/usr/src/6.1.21.2-microsoft-standard$ sudo cp /proc/config.gz config.gz && sudo gunzip config.gz && sudo mv config .config
ebata@DESKTOP-P6KREM0:/usr/src/6.1.21.2-microsoft-standard$ sudo make menuconfig
HOSTCC scripts/basic/fixdep

(中略)

HOSTLD scripts/kconfig/mconf

(ここで、GUIが突然登場してビビったが、"save"を選んで、".config"を選んで終了させる)
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

で、On Windows Terminal.で

$ wsl --shutdown
$wsl -d Ubuntu-20.04

で、

PS C:\WINDOWS\system32> usbipd wsl attach --busid 8-3
usbipd: info: Using default WSL distribution 'docker-desktop-data'; specify the '--distribution' option to select a different one.
usbipd: error: The selected WSL distribution is not running; keep a command prompt to the distribution open to leave it running.

とあいもかわらず、このエラーがでるので、

PS C:\WINDOWS\system32> usbipd wsl attach --distribution Ubuntu-20.04 --busid 8-3

で、対処。

で、WSLからどーなったか見てみる。

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata$ ls -l /dev/video*
crw------- 1 root root 81, 0 Jun 9 00:57 /dev/video0
crw------- 1 root root 81, 1 Jun 9 00:57 /dev/video1

あ、ようやくデバイスがきた。この2行の為に、これまでの苦労があった。

で、後は、https://zenn.dev/pinto0309/articles/e1432253d29e30に記載されているpythonのプログラムをそのまま使わせて頂き、カメラから映像がでることを確認しました。

Corrupt JPEG data: 2 extraneous bytes before marker 0xd6
Corrupt JPEG data: 6 extraneous bytes before marker 0xd2
Corrupt JPEG data: 1 extraneous bytes before marker 0xd0
Corrupt JPEG data: 2 extraneous bytes before marker 0xd0
Corrupt JPEG data: 1 extraneous bytes before marker 0xd4
Corrupt JPEG data: 2 extraneous bytes before marker 0xd3
Corrupt JPEG data: 1 extraneous bytes before marker 0xd0
Corrupt JPEG data: 11 extraneous bytes before marker 0xd3

が出てきていますが、気にしません。

ちなみに、画像が出てこなかったので、XWinrcを起動したところ、表示ができたようです。https://dev.classmethod.jp/articles/wsl-x-window/

と、/dev/videoを作るためだけに、何時間かが溶けました。


ところが、

ebata@DESKTOP-P6KREM0:/dev$ gst-launch-1.0 videotestsrc ! v4l2sink device=/dev/video0
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Could not open device '/dev/video0' for reading and writing.
Additional debug info:
v4l2_calls.c(621): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0:
system error: Permission denied
Setting pipeline to NULL ...
Freeing pipeline ...

って、何だ、これ?

で、やっと分かったんですが。

ebata@DESKTOP-P6KREM0:/dev$ ls -la video*
crw------- 1 root root 81, 0 Jun 9 23:35 video0
crw------- 1 root root 81, 1 Jun 9 23:35 video1

となっていて、

オープンするには

  • root ユーザ
  • video グループに所属

である必要があるらしいのです。

だた、どーしてもGstreamerでは表示できないのですよ
(以下に続く)

WIndows10のWSL Ubuntu-20.04に仮想の/dev/video*を作って、Webカメラ C270n をGstreamer で表示できるようにするまでの軌跡

 

2023,江端さんの技術メモ

WSLでUSBカメラをどうにかしたくて、すったもんだしていました。

で、管理者モードでPowershellを立ち上げて

PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* docker-desktop-data Stopped 2
Ubuntu-20.04 Running 1
docker-desktop Stopped 2

の部分の1を2にしなければならないことが分かったので、

Windows10のWSLをWSL2に変換する手順

を参考にさせて貰って、

PS C:\WINDOWS\system32> wsl --set-version Ubuntu-20.04 2

をやりました、

ところが、数分どころか、いつまで経っても終わらないのでCrtl-Cで強制打ち切りをしたら、wslが全く動かなくなってしまいました。

いろいろやったのですが、最終的には、

起動しなくなったWSL2を復活させるまでにしたあれこれ

を参考にして、元に戻すことができました。

(大変失礼ながら、以下コピペをさせて頂いております。上記のページのリンクが切れると、私がパニックになりますので)

WSL2無効化→有効化

Ubuntuアンインストールでダメな場合(ダメでした)、WSL2を一回機能をオフにして再起動します。

「コントロールパネル -> プログラム -> Windowsの機能の有効化または無効化」を選択します。

「Linux用Windowsサブシステム」のチェックを外して再起動します。

で、チェックを外してから、なかなかシステムが終了を出してこないのですが、ここばガマンです。それでも10分はかからないと思います。

でもって次は、「Linux用Windowsサブシステム」のチェックを付けて再起動します。これも、いい感じでまたされますが、我慢します。

で、これらを終えて、やっと、コマンドプロンプトから、

$ wsl -d Ubuntu-20.04

と入力したのですが、それでも動きません。

管理者モードでPowershellを立ち上げて、

$ wsl --update

をして、別画面を経ち上げなおして、再度、

$ wsl -d Ubuntu-20.04

をしたところ、やっと、元の環境に戻りました(多分)。

「WSLでUSBカメラをどうにかする」をとっとと諦めていれば、こういう目に合わないのですが ―― エンジニアの性(さが)ですかねえ。

まあ、「別のマシンで同じ環境のシミュレータが動いている」という安心感があってのことでしたが。

で、まあ、ここからまた挑戦するんですよ。性懲りもなく。