Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable UDP port 21324 in trezor-user-env-mac #55

Open
matejkriz opened this issue May 27, 2021 · 12 comments
Open

Enable UDP port 21324 in trezor-user-env-mac #55

matejkriz opened this issue May 27, 2021 · 12 comments
Assignees
Labels
question Further information is requested

Comments

@matejkriz
Copy link
Member

To be able to use Trezor emulator with Suite in Android simulator, we need to be able to communicate on UDP port 21324.

Adding

- "21324:21324/udp"

in compose.yml doesn't work for me.

Testing using this node script:

var udp = require("dgram");

function callback(msg, info) {
  console.log("Data received from server : " + msg.toString());
  console.log(
    "Received %d bytes from %s:%d\n",
    msg.length,
    info.address,
    info.port
  );
}

var client = udp.createSocket("udp4", callback);

var data = Buffer.from("PINGPING");

client.on("message", callback);

client.send(data, 21324, "127.0.0.1", function (error) {
  if (error) {
    client.close();
  } else {
    console.log("Data sent !!!");
  }
});

It does work on linux using network_mode: "host", at least for @szymonlesisz

And it works fine if I run stadalone Trezor emulator outside Docker, so this it the way to develop Android app in simulator so far.

@tsusanka
Copy link
Contributor

To be able to use Trezor emulator with Suite in Android simulator, we need to be able to communicate on UDP port 21324.

This is true for Android because it obviously does not use Bridge but some React Native thing right? For desktop we do not have to expose emulator because we communicate with it via Bridge. Am I right? Just putting my thoughts together :)

@matejkriz
Copy link
Member Author

@tsusanka Yes, React Native has its own bridge. The UDP one is there for development purposes only because it's not possible to connect USB device to Android simulator.

@tsusanka
Copy link
Contributor

Got it. It is dubious the change you suggested does not work. You are on Mac right? Have you put the - "21324:21324/udp" into the Mac section of the compose.yml?

@matejkriz
Copy link
Member Author

yeah, I have put it in trezor-user-env-mac section and even trying to run it without compose using docker run with the same params

@tsusanka
Copy link
Contributor

tsusanka commented May 31, 2021

That is curious. @vdovhanych do you think you could try to help with this? :)

@vdovhanych
Copy link
Member

Unfortunately, I cannot test it on my Mac as it's M1. I cant run emulators yet (working on it). Tested it on Linux, and yes, it does work there. As to the problem with mac, I don't think it's related to the ports. It opens them as supposed to, but Matej's script isn't getting the response from the emulator.

@tsusanka
Copy link
Contributor

@matejkriz could you share what your script returns when run in the docker setup? I suck at reading JS

@matejkriz
Copy link
Member Author

@tsusanka the testing script returns only Data sent !!! when the emulator run in docker.

When I run the standalone emulator and bridge built on my Mac, I get:

Data sent !!!
Data received from server : PONGPONG
Received 8 bytes from 127.0.0.1:21326

Data received from server : PONGPONG
Received 8 bytes from 127.0.0.1:21326

@tsusanka
Copy link
Contributor

tsusanka commented Jun 6, 2021

One more thing to clarify: @matejkriz do you see the emulator? I mean does it launch? So you see it in your OS but the communication does not work?

@matejkriz
Copy link
Member Author

yes, the emulator does launch, just no response on PINGPING message

@tsusanka tsusanka added question Further information is requested and removed P2 Medium labels Apr 19, 2022
@tsusanka
Copy link
Contributor

@matejkriz is this still relevant? Could you try again?

@matejkriz
Copy link
Member Author

will try

cc @Nodonisko

@matejkriz matejkriz self-assigned this Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants