honeylab's blog

各種ハードウェアの改造、主にファミコンミニなどをやってます(ました)

BleemSync1.0を使ってプレステクラシックにソフトを追加する(と、バグ回避方法)

modmyclassic.com

1.0はいつ出るんだ、2月30日じゃないのか、と言われ続けてましたが先日ようやくリリースされました。

0.xではUIもなく、手動で配置したゲームイメージを再構築するコンソールアプリと
ペイロードと呼ばれるプレステクラシック上で起動するスクリプト一式で構成されていましたが、
1.0ではWebサーバを内蔵し、USBケーブルでPCに接続するとAndroid Gadget(RNDIS)として認識され、ブラウザからゲームをアップロードできるようになりました。
詳しい使用方法は公式サイトからリンクされているYoutube動画を参考にするといいと思います。

 

ちょっとハマった点として、イメージを作成するときに自動的に .BIN .CUEファイルが作られていたのですが、プレステクラシック側ではどうも小文字拡張子でしか正常に動作しないようです。
そのため、最初はファイル名だけリネームしていたのですが、CUEファイル内にBINファイルの記述があり、こちらもbinに治す必要がありました。
この辺、アップローダで自動でハンドルできるようになるといいんですけどね。

ソースコードは全部公開されているので、誰か直してプルリクするんだ)

 

加えて、現時点では一部の機能(EMMCとUSBに入れたゲームを同時に内蔵メニューに表示させる)に日本タイトル版のコンソールでのみ発生するバグが有り、この機能を有効にしたままでは内蔵メニューの起動すらできない状態になっています。
そのため、公式サイトの使い方を参照した上で、以下のオプションを無効にすることで
USBに入れたメニューのみを表示する方法で使用することができます。

f:id:honeylab:20190126212655p:plain

日本版のプレステミニに含まれるゲームタイトルが格納されたDBのカラムに改行が含まれているせいで、EMMCとUSBのゲームをまとめるスクリプトが想定外の動作をしているようです(一時ファイルにCSVを使用していた)。
日本版以外ではそんなことはないので、昨日実行して詳細にデバッグするまで気づきませんでした。

近々パッチが出るはずですので、それまでは上のオプションを無効にしてください。

はい、というわけでやっとこさBleemSyncで動きましたよ、と。

 

CD-ROM driver On Playstation Classic

It is technical test.It is NOT useful to you.

I Use USB-IDE converter and 5-inch CD-ROM drive.

 

1. Stock kernel is not include scsi/cdrom driver.
 There are drivers for CD-ROM on Playstation Classic default kernel.

Dropbox - cdrom.tar.gz

2.Extract them and copy to working USB or any.

3. on console...

> insmod cdrom.ko
> insmod sg.ko
> insmod sr_mod.ko

4.Plug USB-IDE-CDROM drive to PSC

If insmod succeeded , /dev/sr0 will appear.

5.Mount filesystem

> mount -r -t iso9660 /dev/sr0 /tmp/cdrom/

You can read CD-ROM files on PSC.

f:id:honeylab:20190116001539p:plain

Can I create ISO on PSC... ? what tools...

 

Succeeded to working PlayStation Classic Rear-USB-Port as HOST

ぶっちゃけ私自身はこれそんなに重要な機能だと思ってなかったんだけど、
どうしても背面USBをOTGにして前面をすっきりさせたいっていう要望は結構あったみたいなのでアレコレしてみた。

 

まず、デフォルトのカーネルのオプションではOTGが無効になってる。

 ここで、コンパイルプションでOTGを無効にすると、microUSBのIDピンか、VBUSを見てUSBのモードを切り替えるコードも一緒に有効化される。
(というか、普通のAndroid携帯とかではそれでいい)

この状態でコンパイルするとコンパイルは通る。

が、PSCではIDピンやVBUSはSoCにつながっていないように見える。
IDピンやVBUSとの接続はDeviceTreeファイルで設定するらしいんだけど、
実際につながっているかどうかわからないので設定できない。
この状態でカーネルを起動させると、DTファイルに設定されてない、といってKernelが起動せず止まってしまう。


なので、DTファイルから読み込んで、IDピンの監視をするあたりを
まるっとコメントアウトしてしまう。
これでは切り替えができないように見えるのだが、
ソフトウェア切り替えを有効にするオプションがある。
これを使うと。

echo host > /sys/devices/platform/mt_usb/swmode

 のように起動中に強制的にHOSTモードに切り替えるようにできた。

とりあえず、使う人がいるので置き換えるファイルだけおいておく。

Dropbox - usb20_host.c.patch


SONYの公開しているファイルからこれを一個だけ置き換えて、

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-


make aiv8167_rockman_emmc_defconfig

してできたimageをPSCのBOOTIMG1から抽出したDTBとまとめてFITイメージにして
fastbootか起動してる状態からBOOTIMG1に書き込んでやればいいけど、
文鎮化したときに自分で治せる人以外やってはいけない

ここまで読んでわからない人には難しいけど
近いうちにBleemSyncの機能としてマージされると思うので待っててね

Big progress on Installing PSC custom kernel

BleemSyncの目標であるカスタムカーネルの書き換えについてDiscordのModMyClassicのメンバーで解析を進めていましたが、どうやらカーネルの書き込みについての目途が立ったようです。

もともとPSCのカーネル領域はBOOTIMG1/BOOTIMG2の二枚構成だったため、
何らかのアップグレード手段が残されていると考えられていました。
MISCパーティションに特定の値を書くとその辺が作動するようです。

とりあえず、一般的なUSBキーボードを認識してくれない(ignoreと表示される)オプションを外し、ようやく動きそうなBOOTIMGが出来上がって来たので、
fastboot経由で書き込んで見たところ、書き換えに成功しました。
flashコマンドが存在することは前から分かっていましたが、
動くかどうかを試すために何かを書き込むのはさすがに危なくて誰も試してなかったんじゃないでしょうかね。

まぁ、イメージの作成は一回目失敗してて文鎮化してるんですが(復活できた)

 

 > sudo fastboot flash BOOTIMG1 ../linux/myuboot.bin

fastboot: processing commands
fastboot: getvar:partition-type:BOOTIMG1[len:30]
fastboot:[download_base:0xfffffff044000000][download_size:0x0]
fastboot:[cmd:getvar:]-[arg:partition-type:BOOTIMG1]
fastboot: getvar:max-download-size[len:24]
fastboot:[download_base:0xfffffff044000000][download_size:0x0]
fastboot:[cmd:getvar:]-[arg:max-download-size]
fastboot: download:0053d3a0[len:17]
fastboot:[download_base:0xfffffff044000000][download_size:0x0]
fastboot:[cmd:download:]-[arg:0053d3a0]
fastboot: flash:BOOTIMG1[len:14]
fastboot:[download_base:0xfffffff044000000][download_size:0x53d3a0]
fastboot:[cmd:flash:]-[arg:BOOTIMG1]
cmd_flash: BOOTIMG1, 5493664 

 カスタムカーネルで起動したログを貼っておきます。

Custom kernel for PlayStation Classic startup log — Bitbucket
ちょっとオプション変えただけなので特に変わってるように見えないですが、

デフォルトはこっち

Playstation Classic UART login console startup log — Bitbucket

起動時に真っ先に見るここ

[ 0.000000] <0>-(0)[0:swapper]Linux version 4.4.22 (hiromitu@hiromitu-HP-ProBook-6560b) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) ) #10 SMP PREEMPT Tue Jan 1 16:47:59 JST 2019

[ 0.000000] <0>-(0)[0:swapper]Linux version 4.4.22 (mtk@b02b676401a1) (gcc version 6.2.0 (GCC) ) #1 SMP PREEMPT Sun Sep 9 15:21:14 UTC 2018
 

 が変わってると、あぁ書き換えてやったんだ、っていう達成感がありますね。

とりあえずHIDの周りをまともにしたので、あとはOTGですね。
わかる人がやればそんなにかからないと思いますが、わからんw

Embedding a USB hub into console detail explain

honeylab.hatenablog.jp\

I have worked to add 3rd USB port to PSC .

I must  expolain more detail for Add more USB port by embedding USB Hub method.

 

Prepared Parts and Tools.

1. Soldering Iron. Around 30W (boostable to about 100W)

2. Thin and soft wire such as UEW or colored wile from USB cable.

3. USB Hub PCB or DIY USB HUB kit.

 ex. nano hub 

www.tindie.com

www.aitendo.com

( I have teardown my cheap USB HUB)

f:id:honeylab:20181213085952p:plain

 

How to soldering

This picture is around of USB port.

f:id:honeylab:20181230215833p:plain

Around USB Port

There are 4 SMD resistors.
Two of them(15k ohm) are Pull-down resistor.It is available to remove safety because I connect USB Hub direct , this line level are fixed.
Other two resistors(22 ohm) are dumping resistor.It is used for wave stable , but short wire will take few effect.

f:id:honeylab:20181230215916p:plain

 

f:id:honeylab:20181230220246p:plain   f:id:honeylab:20181230220319p:plain 

Remove 4 registor.
Soldering Point comes out, but it is too small to pull out the wire.
So, I devise to cut two lines.

 

f:id:honeylab:20181230220748p:plain     f:id:honeylab:20181230220837p:plain

More wide area are available for pulling out wire.

 

Pass through a USB hub
f:id:honeylab:20181230220948p:plain

If your USB Hub has upstrem connector, You cut cable and direct connect with solder.

And USB hub's power will pull from microUSB's VCC pin.

 

Check Points.

1. Do not contact each lines or ground area.

2. Make short length wiring.

3. Confirm D-(DM,White Line Color), D+(DP,Green Line Color)

4. Dont forget VCC and GND line.

5. For good result , you shoud use short shieled cable if you can.

 

The explanation so far is theoretical.
Other man works make other result.
I will take a my console's picture and show it someday.

 

Any questions to hiromitu2120@gmail.com or twitter 

twitter.com

or 

honeylab (u/honeylab) - Reddit

some executable for psc shell (gdbserver , nano , etc )

Dropbox - rootfs.ext2.gz

PSCのハックに使っているバイナリ集です。

デフォルトで入っているbusyboxだといろいろ足りないのでアプレットたぶん全部入りと、gdbserverやらなにやらが入っています。

gunzip するとファイルシステムのイメージが出てくるので

 mount -o loop rootfs.ext2 (mountpoint)

とかでマウントして、適当にどうにかすると使えます。

入ってるexecutableのリストはこれ

そのほかにもいろいろ入ってるけど。

www.dropbox.com


わからないことがあればtwitterかdiscordで聞いてください。

 

There is my development binary tools build with buildroot.

if library missing 

set LD_LIBRARY_PATH environment value

Ask me on twitter or discord.

 

Hack to avoid for PSC ignore almost of Keyboard or Mouse with Bluetooth

You know, press some keyboard on PSC show emulator menu, 

but almost of keybord is ignored by PSC kernel.

Because kernel is built with this config.

"ignore USB Mouse and Keyboard"

 Some of keyboard which it can work on PSC , it is reading raw USB code.

f:id:honeylab:20181219105341p:plain

this code shows kernel blocks any USB-Keyboard or USB-Mouse to use HID device.

I can remove because this is built-in driver .

 

Then , I will use Bluetooth keyboard or Mouse

BT-keyboard or Mouse will not be handled USB-HID but Bluetooth HIDP layer.

 

Compile bluetooth kernel modules from Sony OSS linux kernel.

GitHub - bakueikozo/psc_bluetooth

There are pre-built bluetooth kernel module drivers and bluz binalies executable.

insmod with my script

insmod drivers/bluetooth.ko
insmod drivers/bcm203x.ko
insmod drivers/btbcm.ko
insmod drivers/btintel.ko
insmod drivers/btmrvl.ko
insmod drivers/btqca.ko
insmod drivers/btrtl.ko
insmod drivers/btsdio.ko
insmod drivers/ath3k.ko
insmod drivers/btusb.ko
insmod drivers/bpa10x.ko
insmod drivers/hci_uart.ko
insmod drivers/hci_vhci.ko
insmod drivers/hidp.ko

 

 BT keyboard and mouse are used as /dev/input[n] 

And some Bluetooth Gamepad are woked on PSC!!