honeylab's blog

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

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!!

 

 

 

Playstation Classic Online ? (USB-Ethernet and USB-WiFi )

USB-有線LANデバイスの動作確認はすでに @NV 氏によって行われていたのですが、

twitter.com

ロスコンパイルよくわかんないおじさんはなかなか追いつけずに先日ようやくネットにつなげることができました。

カーネルモジュールのコンパイルとPSCへのコピー、insmodが必要ですが、
以下のデバイスが同じモジュールで認識できました。

f:id:honeylab:20181217151748p:plain

Logitec LAN-TXU2C

BUFFALO LUA3-U2-AGT

BUFFALO LUA3-U2-ATX

BUFFALO LUA-U2-KTX

そのうち帯域とか調べてみたいと思います。

 

 

続いて、ネタで時々上がっている無線LANドングルですが
あれこれ頑張った結果、ついに認識しました。

f:id:honeylab:20181217151912p:plain

 

BuffaloのWLI-UC-GNM2Sでrt2800ドライバを導入しました。

PlayStationClassicに挿したドングルをad-hocに設定し、

iPhoneからも検出できますので、iPhonetelnetクライアントでPSCをいじることもできます(何の役にも立たない)

f:id:honeylab:20181217152255p:plain

 

さて、だんだん自動化もできてきたのでスクリプト化してパッケージ化したいところなんだけど…

 

Playstation Classic MOD chip for avoid USB current limitation

電流制限回路の制限電流設定用の抵抗値を変更することで、
本体ポートの電流制限値を引き上げることができました。
上流の回路を確認していないので本当に問題ないかどうかまでは確認していませんが、
とりあえずセルフパワーのハブとUSBメモリ3本とコントローラを同時に認識できています。

f:id:honeylab:20181215233658p:plain

----------------------------------------------------------------------------

in Reddit, u/saaguirre has tested USB power load.

More experiments on USB mystery. Trying to find USB ports supply limit : PlaystationClassic

And he have found datasheet.

f:id:honeylab:20181215214049p:plain

 

This Chip is not FET, but USB current limit IC TPS2533.

label "15JL" is match.

http://www.ti.com/lit/ds/symlink/tps2553d.pdf

 

f:id:honeylab:20181215213945p:plain

f:id:honeylab:20181215213548p:plain

 

This parts works as current limitter for USB port avoid over-current.

f:id:honeylab:20181215214333p:plain

But , in PSC , I wonder it is designed for avoid connection 3rd-party controllers,HUBs,USB Flashes.

 

BTW, We can avoid this USB current limitation with canging RLIM resistor.

This graph is shows between RLIM and Current Limit.

f:id:honeylab:20181215215112p:plain

 

f:id:honeylab:20181215220502p:plain

There are series resitors are 6.2kΩ + 220kΩ.
It is 100mA setting on above table and Sony used just this value.

 

So, I want to more current , such as 500mA , use < 45kΩ.

 (226.2 * x) / (226.2 + x )< 45  , x < 56 

Use <56kΩ resistor.

f:id:honeylab:20181215222610p:plain

So ,Lets solder 56KΩ resistor to (1) or (2) point.

f:id:honeylab:20181215232839p:plain

Oh...I have not 56k just now.. but I can use 47k temporary!

If I will use 47k  , total resistance is 39k.
This value works limitter for 600mA - 700mA.

 

Don't Worry!!!!

 

This is my MOD Chip !!!

f:id:honeylab:20181215233942p:plain

Solder It! 

 

f:id:honeylab:20181215233112p:plain

This modification release current limit, but some problem will occur what I didn't know.

 

f:id:honeylab:20181215233658p:plain

 

I can use three USB flash driver and controller with non-powerd HUB on Port1.

Before this work , It was impossible.

f:id:honeylab:20181215233748p:plain



You can use OTG Cable or Powered-HUB for such using.

This is a experiment.