solosky / pixl.js

An emulator for Amiibo!
GNU General Public License v2.0
557 stars 109 forks source link

Is possible to implement fimrware update via NFC cardreaders via PC? #223

Open Wohlstand opened 4 months ago

Wohlstand commented 4 months ago

Hello!

I do have such card reader that gets plugged via USB: photo_2024-03-24_19-59-29 photo_2024-03-24_20-04-44

It works on Linux through the pcsc library (an output of pcsc_scan tool is here): Снимок экрана от 2024-03-24 20-08-46

And I got a question: I do see already the use of iNFC thing on mobile devices, but what about PC support with the NFC devices?

impeeza commented 4 months ago

May be possible, but practical I don't know, the average firmware is 1.2 MB and NFC normally transmit 1 Kb/s and you need that space free on the internal storage which is normally 1.8 MB so who knows!

solosky commented 4 months ago

Possible, but not recomended, because comparing NFC, the BLE is most common hardware support by many device and nrf52 sdk and nrf toolset has built-in support for DFU by BLE.

Wohlstand commented 4 months ago

Oh, about the NFC case I probably confused while I attempted to understand the manual 👀 I do have BLE adapter on my PC, and device gets clearly detected by Linux Mint's Bluetooth manager, however, to submit data need to have a program that supports custom protocols. I tried to run the nFR Connect thing, but it just can't detect anything (need to install dependencies to get it work properly).

impeeza commented 4 months ago

You can use chrome on the Linux pc to upload firmware using the webpage

Wohlstand commented 4 months ago

I already tried Chromium and M$ Edge, and it is unable to find anything, even at the specification of Web Bluetooth is noted that this API is experimental and is not yet properly standardised and desktop browsers doesn't implement it well. Maybe I'll try to make a kind of console tool that will use the raw Bluetooth directly? Just to upload/get files easily and send firmware updates vi DFU. Actually I wanted to build from the source code the modified version of firmware and try it out, but right now I waiting when a compatible programmator will arrive me. I wanted to try with Bluetooth way but I know the risk to brick the device without having a programmator.

Wohlstand commented 4 months ago

Actually, using experimental APIs is 峨峨, using Web APIs that depends on minor set of browsers is 峨峨, and using Web that works on remote server for me is 峨峨 (I prefer standalone tools that will 100% work even Web server will be gone forever).

Wohlstand commented 4 months ago

Anyway, how much is possible to turn the existing Web application into Electron-based app?

impeeza commented 4 months ago

The website is based on VUE so may be because you also can create Electron apps using VUE.

Wohlstand commented 4 months ago

The website is based on VUE so may be because you also can create Electron apps using VUE.

I trying that to do now, first I need to tweak some files to make them not fail... Actually, Electron has working Web Bluetooth thing, so, it's possible that it WILL work.

Wohlstand commented 4 months ago

Actually, for Electron case needs some small refactoring :thinking: : https://www.electronjs.org/docs/latest/tutorial/devices

Schokobecher commented 3 months ago

I don't see the point in turning the current web app into an Electron app, adding more Chromium doesn't really make sense seeing how bare-bones the app is.

The BLE portion works fine, as well as the DFU app in Vivaldi on macOS, so I would assume the Linux Chromium should also work

Wohlstand commented 3 months ago

The latest Chromium just fails: image

Google Chrome fails too: image

Yandex Browser too: image

Actually, as I said, this API is experimental and doesn't properly works everywhere: https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API#browser_compatibility

Wohlstand commented 3 months ago

Actually, this feature is only works when enable Experimental Web platform features flag: Снимок экрана от 2024-04-04 15-33-12

Снимок экрана от 2024-04-04 15-33-31

Снимок экрана от 2024-04-04 15-34-48

Actually, standalone application that "just works" without of necessary for users to have Internet even, and without of necessary to enable experimental browser's features just for one small feature would be better as I think.

Wohlstand commented 3 months ago

Additionally, the Web Bluetooth API gets been refused by Mozilla because of security risks and complication of maintenance (including the blacklist of vulnerable/faulty devices).

Schokobecher commented 3 months ago

Actually, this feature is only works when enable Experimental Web platform features flag: Can't confirm that: CleanShot 2024-04-05 at 00 28 59@2x

BLE Transfer and DFU work fine with my 2019 MBP

Wohlstand commented 3 months ago

Vivaldi is not fully Chromium, its way reworked including several features. On my end is a pure unmodified Chromium of the super latest version.

Schokobecher commented 3 months ago

With a freshly installed Google Chrome (Stable, v123.0.6312.107) CleanShot 2024-04-05 at 02 42 40@2x Fresh Profile, never installed on this machine, this is not a Chrome/Chromium issue I've been promoted by macOS if I want to allow Google Chrome to use Bluetooth, and the Pixl showed right up

I also tested pure Chromium

CleanShot 2024-04-05 at 02 53 24

deekue commented 1 month ago

FWIW, I've had some success on Linux

Ubuntu 22.04.4 Google Chrome 125.0.6422.141 (with Experimental Web Platform features enabled) allmiibo LCD 2.10.2

firmware update worked via https://thegecko.github.io/web-bluetooth-dfu/examples/web.html

had some issues with BLE File Transfer via https://pixl.amiibo.xyz enable 'BLE File Transfer' on the device, then click the 'Connect' button on the webiste, the pop-up window spins and scanning shows 'No compatible devices found'.

I went to the Bluetooth control panel and saw that a 'Pixl.js' device was listed as paired but not connected. Removed the pairing and then the scanning worked and it connected fine.