How to use bta2dpd(8) with Bluetooth headphone under NetBSD-current

Introduction

When USB Bluetooth dongle (ubt(4)) is used, classic Bluetooth SCO Audio (btsco(4)) requires USB isochronous transfer and ehci(4) and xhci(4) of NetBSD-current does not support USB isochronous transfer mode, So I cannot use btsco(4) to play audio under NetBSD-current.

Some time ago, bta2dpd(8) was imported to NetBSD-current by nat@. I had not tested bta2dpd(8) and I should test bta2dp(8) with Jabra MOVE Wireless. As a result, I can play audio with ubt(4) and Javra MOVE Wireless.

Basic Bluetooth settings

How to pairing and selecting profile is as same as btsco(4). Please perform the following steps.

At first, run daemon/service for Bluetooth. Please perform the following steps.


# vi /etc/rc.conf
bluetooth=YES
# /etc/rc.d/bluetooth start
configuring Bluetooth controllers: ubt0.
starting Bluetooth Link Key/PIN Code manager
starting Bluetooth Service Discovery server
If your Bluetooth connection is temporary, you can perform the following steps instead.

# /etc/rc.d/bluetooth onestart
configuring Bluetooth controllers: ubt0.
starting Bluetooth Link Key/PIN Code manager
starting Bluetooth Service Discovery server

Next, turn your wireless headphone to pairing mode and perform the followings to get Bluetooth address.


$ btconfig ubt0 inquiry
Device Discovery from device: ubt0 ... 1 response
  1: bdaddr XX:YY:ZZ:XX:YY:ZZ
   : name "Jabra MOVE v2.5.0"
   : class [0x240404] Wearable Headset  
For easier to identification, record this address in /etc/bluetooth/hosts as headset1.

# vi /etc/bluetooth/hosts
XX:YY:ZZ:XX:YY:ZZ headset1

Next, set Bluetooth PIN.


$ btpin -d ubt0 -a headset1 -p 0000
Jabra MOVE Wireless assumes PIN as 0000.

Next, the device, set headset1 as headset (HSET).


# btdevctl -d ubt0 -a headset1 -s HSET -A
XXX: This setting is not required. (2020-06-06)

Above procedure is as same as btsco(4). I will use bta2dpd(8) as follows. Perform basic test.


$ file test.wav
test.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
# bta2dpd -a headset1 test.wav
You may want to play mp3 file or others. If you use mplayer with OSS, you can use pad(4).

# bta2dpd -a headset1 /dev/pad
After this invocation, you can see as follows in your dmesg.

pad0: outputs: 44100Hz, 16-bit, stereo
audio2 at pad0: half duplex, playback, capture, mmap
pad0: Virtual format configured - Format SLINEAR, precision 16, channels 2, frequency 44100
spkr3 at audio2: PC Speaker (synthesized)
wsbell at spkr3 not configured
This messages show you that if you play audio to /dev/sound2, your audio stream will appear in /dev/pad0. For example, the following command plays audio your Bluetooth headphone.

$ mplayer -ao oss:/dev/sound2 test.mp3

Conclusion

You can use Bluetooth audio with xhci(4) of NetBSD-current.

Facebook Live用のビデオ配信アプライアンス

Facebookはほとんど使わないのだが、 最近はFacebook Liveというリアルタイムビデオ配信の仕組みがあるらしい。

eWeekの記事を見ていたら、 Wowza Launches Professional Streaming Appliance for Facebook Liveという記事が目についた。 Facebook Live専用のビデオ配信用アプライアンスWowza ClearCasterというのが発売されたとのこと。

ビデオ撮影する機器さえ持っていないので、自分が使うことはなさそうだが、技術的には気になる。

archive.orgでMIT Pressの昔の書籍を借りられるようになった

Free: You Can Now Read Classic Books by MIT Press on Archive.orgで知ったのだが、https://archive.org/details/mitpressで、MIT Pressの昔の書籍を借りて読むことができるようになっている。 archive.orgのアカウントで、14日間を期限に貸し出ししてもらえるもの(貸し出しできる最大数が決まっている)と、自由に閲覧できるものがあるようだ。

A FORTRAN Coloring Bookは、貸し出し制限はないようだ。 Landmarks in American civil engineeringは、最大5冊まで貸し出ししてもらえるようだ。

A FORTRAN Coloring Bookを読んでみたが、もちろん古いFORTRANの構文を説明している書籍なのだが、ほぼ全てイラストで解説されていておもしろい。これのCOBOL版があったら読みたい。FORTRANは、Fortran 77を使っていたことがあるので、あまり新しい発見がなかったので。

Landmarks in American civil engineeringは、アメリカの著名な土木構築物の写真を白黒ではあるが見ることができておもしろかった。

GCCの定義済みマクロを一覧する方法

pkgsrcの作業をしていると、そのアーキテクチャーでのCの定義済みマクロ(predefined macros)を一覧したい場合がある。 その方法をいつも検索して調べていたのだが、最近はいつも見ているウェブページではないウェブページがGoogleの検索結果の上位に来ていて、 本当にこれで良かったか不安になってしまうので、ここに書いておく。

http://mkosaki.blog46.fc2.com/blog-entry-232.htmlをいつも参照していていたはずである。 ここでは、


$ cpp -dM /dev/null
と言うのが挙げられているが、私は以下のように読み替えている。

$ gcc -E -dM -xc /dev/null | less

Google Fuchsiaのカーネルの名称変更

Google Fuchsiaというオペレーティングシステムが開発中であるが、そのカーネルであるMagentaがZirconと名称変更されたようだ。

結構頻繁にコミットされているようなので、追い掛けてみたいが…

Ubuntu Linux 17.04でCaps LockキーをCtrlキーにする設定

Ubuntu 16.04 CapsLockをControlに置換する方法が、17.04にも当てはまった。

/etc/default/keyboardというファイルにある XKBOPTIONS=""のようになっている行を、 XKBOPTIONS="ctrl:nocaps"のように書き替えて再起動すれば良い。

少なくともNetBSDだと/etc/defaultsディレクトリーのファイルは 直接編集はせずに、 /etcディレクトリーの同じファイル名のファイルを編集して 設定を上書きするのだが、Ubuntu Linux 17.04ののkeyboard(5) man pageによると、 これは直接修正するもののようだ。

/etc/default/keyboardファイルは、コンソールとX Window Systemの 両方に効果を持つファイルとのことだが、 X Window Systemでだけ有効になれば良いのであれば、ログアウトしてログインし直せば良いようにも見える。

Microsoft Officeの32ビット版と64ビット版が共存できるか?

Microsoft Office 2010の32ビット版と64ビット版が同時にインストールできるかと言うと、同時にインストールすることはできないのだが、根拠がいつもどこにあったのか忘れてしまうので、ここに書いておく。

Compatibility Between the 32-bit and 64-bit Versions of Office 2010に、FAQの節があって、Can I install 64-bit and 32-bit versions of Microsoft Office side-by-side?という質問に対してNo.と回答されている。

文化庁の自由利用マーク

文化庁の自由利用マーク というのがあって、 ITmediaの記事「文化庁、CCライセンスを支援へ 独自ライセンス構築は断念」 によると、2013年の時点で普及はあきらめているらしい。 文化庁のウェブページを見ても、そもそも「コピーOK」「障害者OK」「学校教育OK」とい...