2023,江端さんの忘備録

ChatGPTが、困った時にプログラムのサンプルを提示してくれます。

ChatGPT will present me with sample programs when I need help.

これには大変助けられています。

This has helped me tremendously.

が、困ったこともあります。

But there are also some troubling times.

『ChatGPTは、もの凄く真摯な言葉で、嘘をつく』です。

"ChatGPT lies with great sincerity."

これについては、すでに、こちらで散々述べましたし、私は『ChatGPTが悪い』とも思っていません。

I have discussed this extensively here, and I don't think 'ChatGPT is bad.'

まあ、逆にChatGPTの内容が信用できない、ということを、定期的に確認している、という安心感すらあります。

On the contrary, I can confirm the contents of ChatGPT are not trustworthy, and I feel they relied on that.

-----

昨日の質問は、こんな感じでした。

The following is yesterday's question.

こんな風に説明されれば、このコード動くと思いますよね。

If I were explained like this, I would think this code would work.

でも、動かないんですよ。

But it doesn't work.

それどころか、このコードは、存在しないライブラリを勝手に追加していますし、おまけに他の言語(Python)の仕様を、それらしく勝手に組み込んでいました。

On the contrary, this code added libraries that did not exist and even incorporated the specifications of another language (Python) freely.

"それ"に気がつくのに、3時間かかりました。

It took me three hours to realize "it."

その結果、私はPythonでのトライアルを実施するはめになりました。

As a result, I had to conduct a trial in Python.

【Pythonで行う】因子分析

-----

しかし、まあ、ここまで、すがすがしく嘘を書かれると、むしろ気持ちがいいくらいです。

But, well, it is rather pleasant to see a lie written so refreshingly.

それに、Go言語やPython言語の統計手法についても調べることになり、さらに勉強することになりました。

Besides, I had to look into the statistical methods of the Go and Python languages, and I learned a lot.

結果オーライとも言えます。

It can be said that the result is all right.

-----

結論としては、『AI技術は、つきあってみて、上手く利用すること』という、私の主張は、そのままです。

In conclusion, my assertion that 'AI technology should be tried and used well' remains intact.

2023,江端さんの忘備録

昨日の日記を踏まえて、ChatGPTに以下をお願いしてみました。

『この程度の政治ビラなら、ChatGPTで、1分で作れる』が、正直な私の感想です。

Based on yesterday's diary, I asked ChatGPT to do the following

■共産党の選挙用のビラを作って

- Make election leaflets for the Communist Party.

■共産党の選挙用のビラの文言を作成して

- Create the wording for the Communist Party's election leaflets.

■共産党の選挙用の政権批判を記載したビラの文言を作成して

- Create the wording of leaflets containing criticism of the administration for the Communist Party's elections.

■共産党が政権与党を非難するビラの文章を考えて

- Consider the text of a leaflet in which the Communist Party condemns the ruling party.

■政権批判のビラの文言を作成して

- Create the wording for leaflets criticizing the administration.

■LGBT関連法案の問題点とは

- What are the problems with LGBT-related legislation?

-----

これらに目を通した、私の感想は、以下の通りです。

Having read through these, here are my impressions

『街頭演説のビラの方が、はるかにマシ』

"The leaflet from a street speech would be much better."

-----

『もっと、エッジの効いた文言を作れんのかなあ』と思っていました。

I thought, 'I wonder if it can make a more edgy statement.'

"RLHF"のブレーキが強すぎるのかな、とか考えていました。

I thought the brakes on "RLHF" were too strong.

2023,江端さんの技術メモ

【Pythonで行う】因子分析

wsl -d Ubuntu-20.04 で、

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata/go-efa$ python main3.py

で実行可能。

ebata@DESKTOP-P6KREM0:/mnt/c/Users/ebata/go-efa$ python main3.py
[3.61634475 2.11925085 0.87875762 0.5678116 0.37337846 0.08163572
0.15971804 0.20310295]
第1因子 第2因子 共通性
x1 -0.196394 0.917136 0.879709
x2 0.859422 0.067413 0.743150
x3 0.829155 -0.161144 0.713466
x4 -0.017808 0.558695 0.312457
x5 0.984061 -0.063608 0.972421
x6 0.180765 0.850078 0.755308
x7 0.680743 -0.064480 0.467569
x8 0.532039 0.221023 0.331916
第1因子 第2因子
因子負荷量の二乗和 3.212520 1.963477
寄与率 0.401565 0.245435
累積寄与率 0.401565 0.647000

2020/05,江端さんの忘備録

連休中は、自宅に閉じ込もっていたので、昼間もテレビを見ることが多かったのです。

During the consecutive holidays, I kept myself in my house, so I often watched TV during the day.

そして、夜のニュース番組と比べて、昼間のニュース番組のクオリティの低さにビックリしました。

And I was surprised at the low quality of daytime news programs compared to nighttime news programs.

まず、ニュースキャスターの無知性と無勉強 ―― たぶん、あえて「無能」を演じているんだろうと信じたい ―― です。

First, the newscaster's ignorance and no study. -- Maybe I want to believe that they are acting "incompetently".

さらに、番組の中の、

In addition, in the program,

■(結果の出ていない事項も含めて)、政府方針に非難をつけて、全て、総理と大臣の責任へ誘導

- (Including items for which no results have been obtained), blaming the government policy, and guiding everything to the responsibility of the Prime Minister and the Minister

■統計に対する絶望的な誤解(特にRPC検査数に関する「仮説検定」に対する無理解)

- A desperate misunderstanding of statistics(in particular, no understanding of "hypothesis test" regarding RPC test numbers)

■「専門家」と言われる人物の、世論におもねるコメント

- Fawning behavior comment by the person who is said to be an "expert"

それと、私、その「専門家」と言われる人の名前を覚えておいて、Webで検索かけるのですが、まったくの無名、下手すると論文すら書いていない人物だったりもします(もちろん、そうでない人もいます)。

Also, I remember the name of the person who is said to be an "expert" and search on the Web. However some people are completely anonymous, and some do not even write a paper in worst case (of course, some people do not).

私、その人物の実績を評価する時、その人の学歴なんぞは見向きもせず、その人の残しているコンテンツ(論文、コラム、その他なんでもいいが、SNSは除く)は、ちゃんと読むようにしています ―― それなりに面倒ですが。

When I evaluate a person's performance, I'm not interested in that person's educational background, but I try to read the content of the person's papers, columns, anything else, except SNS. --- It's kind of troublesome, though.

なんというか、安い値段で「教授」と名前のつく人を借りて、番組にひっぱり出してきている、という感じがします。

Somehow, I feel that they are borrowing a person named "Professor" at a cheap price, and pulling him/her out to the news program.

という訳で、昼間のテレビは見ないようにして、19時のNHKニュースだけを見るようにしていました。

So, I didn't watch TV in the daytime and only watched NHK news at 19:00.

-----

とは言え、NHKのニュース番組でも、時々、突っ込んでしまうことがあります。

Even for the NHK news programs, I sometimes feed the line.

「"ハッカー"によってセキュリティが破られて」というフレーズは、もう直すこともできないレベルですし、

The phrase "security is broken by "hackers"" is a level that can't be fixed anymore,

「"AI"によって、○○が実現した」というフレーズも、同様です(もう、文句を言う気力もありません)。

The same goes for the phrase "○○ was realized by"AI"" (I no longer have the power to complain).

で、今回、

So this time

「"RAN"という遺伝子が・・・」というフレーズが出てきました。

The phrase "the gene" RAN "..." came out.

―― "RNA"って、遺伝子と呼んでもいいのかな? DNAでもないのに、

"May I call "RNA" a gene? It's not DNA"

と思って、調べてみました。

I looked it up.

『ウイルスの中には,RNAを遺伝子としてもつものも多い』と、マイクロRNA遺伝子についての説明を見つけました。

"There are many viruses that have RNA as a gene," and I found an explanation about the microRNA gene.

-----

「専門外のことは、てんでダメだな」と実感しました。

I realized, "I'm not good at things that aren't my specialty."

2023,江端さんの忘備録

以前、こちらにも書いたのですが、外国で行われたアンケートを見て驚いたことがあります。

I have written about this before, but I was surprised to read a survey done in a foreign country.

『政府キャンペーン、行動グループへの貢献/参加を1年間行わなかった (Yes/No)』

"Did not contribute to/participate in any government campaigns or action groups during the year? (Yes/No)"

私(江端)は、人生で一度も政治的な活動を行ったことがありませんし、日本で、この回答で"No"と答える人をイメージできません。

I (Ebata) have never been politically active in my life, and I cannot imagine anyone in Japan answering "No" to this question.

まあ、最近では、『SNSで』『一回限りで』『その場限りで』『思い付きで』『感情に任せて』でツイートしたり、あるいはフォローしたりする人はいるかもしれませんが、それは、多分、上記のアンケートの範疇には入っていないと思います。

Well, these days, 'On social networking sites.', 'on a one-time-only basis.', 'on the spur of the moment.', "on the emotions," There may be people who tweet or even follow you, but that is probably not in the scope of the above survey.

我が国の国民は、私も含めて、『政府の政策を黙認し、結果が悪ければ批判するだけ』という政治への関与を行っているのだと思います。

I believe that the people of our country, myself included, are involved in politics by 'tacitly accepting government policies and only criticizing them if the results are bad.

別に批判しているのではありません ―― 私だって同じです。

I am not criticizing you -- I am the same.

そして、多くの人にとって、『政治的な関与』って、そんなものでしょう。

And for many, 'political engagement' is like that.

-----

本日は、めずらしく外出したのですが、珍しく、いくつかの駅で「街頭演説」を見ました。

Today, I went out for an unforgettable day, and unusually, I saw "street speeches" at several stations.

私より、10歳は上と思われる議員が演説をして、その母親と思われる人物一人が、おぼつかない足取りでビラくばりをしていました ―― 共産党の方のようでした。

A counselor, who appeared to be ten years older than me, was giving a speech, and one person, who appeared to be his mother, was limping and passing out leaflets -- He seemed to be a member of the Communist Party.

『高齢化問題』のユースケースを見た、と思いました。

I saw a use case for "Aging Matters," I thought.

で、そのビラに目を通してみたのですが ―― 共産党だけでなく、どの政党のビラもそうですが、あいかわらず「数字」と「図表」がない。

So, I looked through the leaflet -- not just the Communist Party, but all parties' leaflets, and as usual, there are no "numbers" and "charts."

財源の担保についても言及がなく、政権与党の非難には、筋の通った理由の記載がない。

There is no mention of the security of financial resources, and the administration's condemnation does not include a compelling reason for the curse.

根拠となる事実の出典も参考文献もない。

There are no sources or references to the underlying facts.

―― 羨しいなぁ

"I'm jealous."

と思いました。

I thought it.

特許明細書やペーパーの製造装置をやらなければならない、現在のこの身の上からは、本当に羨しい。

I envy them from my current position here, where I have to do patent specifications and paper manufacturing equipment.

『この程度の政治ビラなら、ChatGPTで、1分で作れる』が、正直な私の感想です。

"I can make a political leaflet of this caliber in a minute with ChatGPT," is my honest opinion.

-----

もちろん、政治家の方には、それなりの凄い苦労があるのだろうとは思います。

Of course, I am sure that politicians have incredible difficulties.

そもそも、ビラはペーパーではないのですから、沢山記載もできません。

To begin with, a leaflet is not a thesis, so it cannot contain much information.

が、それにしても、「古色蒼然」というビラを見ていると ―― 政治は、デジタルからもっとも遠い分野の一つなんだろうなぁ、と実感します。

But then, when I see the "old-fashioned" leaflets -- I realize that politics is probably one of the fields farthest from digital.

しかし、この『後進性』こそが、この政党、いや、この国の政治の真髄なのかもしれません。

But this 'backwardness' may be the essence of politics in this party or country.

「自分の公約の達成度を円グラフで記載していた」、39歳の理系出身者の方に投票しました。

2023,江端さんの忘備録

最近、ソーシャルキャピタルに関する論文を、かたっぱしから読んでいます。

I have been reading a lot of articles on social capital lately.

「どうやらソーシャルキャピタルのデファクトスタンダードとなる定義はなさそう」という結論になりそうです。

I might conclude, "There is no de facto standard definition of social capital."

そこで、一番最初に、この概念を提唱した人の著書に立ち戻ることにして、自分なりの解釈を開始しました。

So, I decided to return to the books of the first proponent of the concept and began my own interpretation.

あれ? この理屈を推し進めると「友人を多くもっている=現金を多く持っている」「町内会での活動の継続= 定期的な収入源」ということになって、『陽キャ=金持ち』が成立してしまうぞ

『友人は債券である』 ―― この話を嫁さんにしたら、嫌な顔をしていました。

'Friends are bonds' -- I told this story to my wife, and she looked disgusted.

嫁さん:「まあ、『町内会で活動することには金銭的価値がある』というのは良いとしても、『友人に値段が付けられる』という考え方は不快だ」

Wife: "Well, it's fine to say 'there is a monetary value to being active in a neighborhood association,' but the idea that a price can be put on a friend' is offensive."

江端:「不快かもしれないけど、ロジカルだよ ―― 『人間の幸せはお金だけじゃない』という人は多いけど、これは前提として、『お金は幸福を構成する要素であることを否定しない』と白状していることと同じだよね」

Ebata: "It may be uncomfortable, but it's logical -- there are many people who say that 'money is not the only factor in human happiness,' but this is the same as saying point blank that the premise is 'I don't deny that money is a component of happiness.'"

嫁さん:「それは、そうかもしれないけど」

Wife: "That may be true, though."

江端:「では、その『お金だけじゃないもの』は、多分、何かの"価値"だよね。でね、『友人の数で幸福の過多を語れない』というのであれば、「ひとりぼっち」と「一人以上の友人を有する」ということに、幸福の差はない、それは主観の問題だ、と自信をもって主張できる人なんて、この世界にいるかな?」

Ebata: "Then, that 'something other than money' is probably some 'value. So, suppose we can't talk about happiness based on the number of friends. Who can confidently assert that there is no difference in happiness between being alone and having more than one friend and that it is a matter of subjectivity?

嫁さん:「・・・」

Wife: "..."

江端:「『社会的関係を断ち切る人生こそが幸せ』という論文を、私は一つも見つけだすことができなかったし、既往研究のソーシャルキャピタルの総量は、コミュニティや友人の数で算出されていたよ」

Ebata: "I couldn't find a single paper that said the life of disconnected social relationships is happiness,' and the number of communities and friends calculated the total amount of social capital in existing studies."

嫁さん:「・・・」

Wife: "..."

江端:「"友人0人と1人の間には幸福の差異がある"、けど、"1人と2人の間には差異がない"、というのは、論理的におかしいと思うんだけど」

Ebata: "I think it is logically wrong to say that there is a difference in happiness between zero friends and one friend, but not between one and two friends.

-----

もっとも、友人の数が多ければ多いほど良いとは思えませんが、これは、経済学の「限界効用」の概念で説明可能です。

However, more friends are not better, which can be explained by the concept of "marginal utility" in economics.

そもそも、孤独度チェックのアンケートがやっていることは、『友人に値段が付けられる』と同じことを言っている、と思います。

To begin with, the loneliness check questionnaire says the same thing: a friend can put a price on your friend', I think.

UCLAの孤独感尺度で、江端の孤独度を測ってみた件

さて、あなたは、どう思いますか?

Now, what do you think?

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,江端さんの忘備録

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

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.

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