TurboWarp WebUSB PaSoRi

TurboWarp NFC input

TurboWarp WebUSB PaSoRi

Connect Sony PaSoRi readers under project-local names, read NFC card IDm and PMm values, and write IDm values into Temporary Variables.

connect PaSoRi as leftwait on PaSoRi rightlast NFC IDm on left

Installation

Open the user guide at https://kubohiroya.github.io/turbowarp-webusb-pasori/.

pnpm add --save-exact @kubohiroya/turbowarp-webusb-pasori@0.7.0
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-webusb-pasori@0.7.0/dist/webusb-pasori.js

Blocks

connect PaSoRi as

Shows the WebUSB device picker and assigns the selected reader to a name such as `left` or `right`.

wait for NFC card

Polls a named reader until a card is present and stores its IDm.

last NFC IDm

Reports the most recent IDm read by a named reader.

API capability

Unsandboxed extensions can read `Scratch.vm.runtime.ext_kubohiroyawebusbpasori`.

const left = await pasori.connectPasori({readerId: 'left'});
await pasori.connectPasori({readerId: 'right'});
const card = await left.readCardInfo();
const idm = await pasori.waitForNfcIdm({readerId: 'left', signal});

Requirements and limits

This extension is intentionally scoped to Sony PaSoRi card ID reading. WebUSB requires a secure context, browser support, a user gesture, and device permission. Some operating system drivers or browser protected-interface rules can prevent `claimInterface(0)` from succeeding.

Minimal demo / 最小デモ

TurboWarp Editor · SB3

Manual hardware demo. Hardware success is unverified; see README requirements. No audio.

WebUSB PaSoRi: complete block reference

All 5 blocks are documented below, including compatibility blocks and blocks available through optional features. Select a block to read its behavior, arguments, default values, and menu choices. Each block has a permanent link.

connect PaSoRi as [READER_ID]

Requests permission and connects a Sony PaSoRi reader over WebUSB with a project-local reader name.

Block type: COMMAND. Opcode: connectPasoriBlock. Permanent link

ArgumentTypeDefault valueMenu choices
READER_IDSTRINGdefault

wait for NFC card on PaSoRi [READER_ID] set runtime var [RUNTIME_VAR] to IDm

Waits until a card is read on the named PaSoRi and stores its IDm in a runtime variable.

Block type: COMMAND. Opcode: waitForNfcIdmSetRuntimeVar. Permanent link

ArgumentTypeDefault valueMenu choices
READER_IDSTRINGdefault
RUNTIME_VARSTRINGnfcIdm

wait for NFC card on PaSoRi [READER_ID] set runtime var [RUNTIME_VAR] to IDm and broadcast [MESSAGE]

Waits until a card is read on the named PaSoRi, stores its IDm, and broadcasts a message.

Block type: COMMAND. Opcode: waitForNfcIdmSetRuntimeVarAndBroadcast. Permanent link

ArgumentTypeDefault valueMenu choices
READER_IDSTRINGdefault
RUNTIME_VARSTRINGnfcIdm
MESSAGESTRINGnfcScanned

last NFC IDm on PaSoRi [READER_ID]

Returns the most recent NFC IDm read by the named PaSoRi.

Block type: REPORTER. Opcode: lastIdmReporter. Permanent link

ArgumentTypeDefault valueMenu choices
READER_IDSTRINGdefault

connected PaSoRi count

Returns the number of PaSoRi readers connected through this extension.

Block type: REPORTER. Opcode: connectedPasoriCount. Permanent link

This block has no arguments.

Repository guide and examples

アイコンの更新 (0.6.1)

カードを大きくし、カード内のNFC表記を読みやすくしました。一覧とブロックのアイコンに同じ図案を使います。拡張ID・ブロック・実行方法は変わりません。