← index #12216Issue #1701
Related · high · value 0.592
QUERY · ISSUE

ports/unix: please implement machine.unique_id()

openby paravoidopened 2023-08-11updated 2024-10-18
enhancement

What triggered this was my attempt to use micropython-mqtt from the Unix port, in order to run some tests with my code before moving this to an actual board.

The module uses a few things that are not implemented in the Unix port, and probably needs to be ported itself.

One of the issues, however, is machine.unique_id(), which seems... basic enough for the Unix port to have it.

One strategy could be to use gethostid(), which is deprecated in most Unix systems, as it's a 32-bit integer (not very unique). Another one could be to use /etc/machine-id, a UUID, which exists in -at least- modern Linux systems.

A search for /etc/machine-id yields:
https://codesearch.debian.net/search?q=%2Fetc%2Fmachine-id&literal=1
Most seem to be falling back to /var/lib/dbus/machine-id.

CANDIDATE · ISSUE

Recasting current baremetal modules to "umachine"

closedby pfalconopened 2015-12-09updated 2015-12-18

@dpgeorge , @dhylands : I mentioned this couple of times in various related comments, but didn't get response, so here's explicit question:

I'd like to have more or less complete implementation of "machine" module for unix port. The primary motivation for that is testing, but we'll see where it goes. And good part of module would be implemented in Python using FFI, while some part in C, with requires separating module names. How we handle that so far is having builtin module with "u" prefix, and "module symlinks" for baremetal ports. So, I'm asking you how we should handle this for "machine" module.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied