n0gg1n
Hey everyone!
I just want to simulate an uart device on the host pc to test my code locally.
I’m using tty0tty to simulate the uart interface.
My code so far:
defmodule UartSimulator do
use GenServer
@path_tty0tty "/bin/tty0tty"
def start_link() do
{:ok, pid} = GenServer.start_link(__MODULE__, %{})
end
def init(state) do
tty0tty = Port.open({:spawn, path_tty0tty}, [:binary])
port = File.open!("/dev/pts/2", [:write])
{:ok, %{state | tty0tty: tty0tty, port: port}}
end
def handle_cast({:data_reporting_mode, mode, activity}, %{port: port} = state) do
IO.binwrite(port, "hello world")
{:noreply, state}
end
end
Is this the way to go?
And how can I implement this module in my testing environment? I’m getting the error that the module is not available.
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Latest Nerves Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
fhunleth
Hi @n0gg1n,
I use
tty0ttyto test circuits_uart on CI. I start it outside of Elixir, though, since it requires super user privileges to load its special Linux kernel module. After it’s loaded, you should notice new serial ports on your machine calledtnt0,tnt1, etc. They’re connected in pairs. Whatever you send outtnt0comes intnt1and vice versa.I have some docs at GitHub - elixir-circuits/circuits_uart: Discover and use UARTs and serial ports in Elixir · GitHub that might also be helpful.
n0gg1n
Hey @fhunleth,
thanks for your answer! I just wanted to temporary open an uart emulation port with the tty0tty pts program. Unfortunately it didn’t work out the way I wanted. I’m now using the kernel module and it works.
Thanks for your great work!