{"id":24650596,"url":"https://github.com/miathedev/milkv-rust-hid-example","last_synced_at":"2025-08-23T05:05:54.144Z","repository":{"id":273192944,"uuid":"918955110","full_name":"miathedev/MilkV-Rust-HID-Example","owner":"miathedev","description":"Cross-Compiled Rust binary to (yet) draw on a framebuffer device","archived":false,"fork":false,"pushed_at":"2025-01-19T10:37:42.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T11:26:40.858Z","etag":null,"topics":["cross-compile","display","embedded","framebuffer","milkv","milkv-duo","milkv-duo-s","render","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miathedev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-19T10:28:30.000Z","updated_at":"2025-01-19T10:47:49.000Z","dependencies_parsed_at":"2025-01-19T11:37:02.176Z","dependency_job_id":null,"html_url":"https://github.com/miathedev/MilkV-Rust-HID-Example","commit_stats":null,"previous_names":["miathedev/milkv-rust-hid-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miathedev%2FMilkV-Rust-HID-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miathedev%2FMilkV-Rust-HID-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miathedev%2FMilkV-Rust-HID-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miathedev%2FMilkV-Rust-HID-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miathedev","download_url":"https://codeload.github.com/miathedev/MilkV-Rust-HID-Example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244686281,"owners_count":20493414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cross-compile","display","embedded","framebuffer","milkv","milkv-duo","milkv-duo-s","render","rust"],"created_at":"2025-01-25T18:15:57.015Z","updated_at":"2025-03-20T20:42:55.904Z","avatar_url":"https://github.com/miathedev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Hello World for the MilkV-Duo\n\nThis project aims to implement a HID on the MilkV-Duo.\nThe MilkV-Duo doesnt have a GPU or any OpenGL/... acceleration.\nCause of the lack, drawing to a screen is running 100% on the CPU not accelerated.\nPlus - most graphic librarys wont work without OpenGL/Vulkan/... .\nThats why this project started. I wanted a way to simply directly draw to the framebuffer device without X11 or any X11 related hacks.\n\nIt uses the embedded-graphics crate - keep in mind that graphic operations are rather simple compared to software stacks like lvgl (please someone make cross compiling work for the lvgl bindings).\n\nBackground:\nI tryed using the SDL2 and lvgl-bindings crate - but i failed cross compiling it.\nIf someone succeeds cross-compiling them, please create an issue in this repo or write me an email.\n\n## Sources\nBased on: https://barretts.club/posts/i-got-a-milkv-duo/\n\n## Build\nJust run `./compile.sh` once for the initial setup and first build. The script will also install the toolchain required.\n\n## Add a display to the MilkV\nUse the following source:\n\nhttps://milkv.io/docs/duo/resources/spilvgl#bring-up-the-spi-display\nHowever, tho this example is made for the ST7789V - you can easilly add any by linux suported graphic display.\n\nHeres another example:\nhttps://gist.github.com/miathedev/f5a502eec78e4bc113cdb82935824a4e\n\nIts basically always the same. Most important part on the MilkV is patching the fbtft_request_one_gpio function.\n\n## ToDo\n* Remote Debugging\n* Audio\n* Sprites\n* MilkV Mailbox\n* MilkV GPIO\n\n# Known errors/tricks\n\n## Connect to wifi\n### Using wpa_supplicant from the device\nSource: https://community.milkv.io/t/connect-to-wi-fi-on-duo-s/1540\n\nStart wpa_supplicant with:\n\n```\necho \"update_config=1\" \u003e\u003e /etc/wpa_supplicant.conf\nwpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf\n```\nAt this point run:\n```\nwpa_cli -i wlan0\n```\nUse the scan and scan_results commands to see the available networks:\n```\n\u003e scan\nOK\n\u003c3\u003eCTRL-EVENT-SCAN-STARTED \n\u003c3\u003eCTRL-EVENT-SCAN-RESULTS \n\u003e scan_results\nbssid / frequency / signal level / flags / ssid\n11:22:33:44:55:66       5745    -78     [WPA2-PSK-CCMP][ESS]    MYSSID-5G\n11:22:33:44:55:67       2427    -85     [WPA2-PSK-CCMP][ESS]    MYSSID\nTo associate with MYSSID-5G, add the network, set the credentials and enable it:\n\n\u003e add_network\n1\n\u003e set_network 1 ssid \"MYSSID-5G\"  \nOK\n\u003e set_network 1 psk \"password\"\nOK\n\u003e enable_network 1\n```\n\nIf the SSID does not have password authentication, you must explicitly configure the network as keyless by replacing the command set_network 1 psk \"password\" with set_network 1 key_mgmt NONE.\n\nFinally save this network in the configuration file and quit wpa_cli:\n```\n\u003e save_config\nOK\n\u003e quit\n```\n\n```\n[root@milkv-duo]~# ip a\n1: lo: \u003cLOOPBACK,UP,LOWER_UP\u003e mtu 65536 qdisc noqueue state UNKNOWN qlen 1000\n    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n    inet 127.0.0.1/8 scope host lo\n       valid_lft forever preferred_lft forever\n2: eth0: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc mq state UP qlen 1000\n    link/ether 66:69:54:69:1c:2c brd ff:ff:ff:ff:ff:ff\n    inet 169.254.206.92/16 brd 169.254.255.255 scope global noprefixroute eth0\n       valid_lft forever preferred_lft forever\n3: usb0: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc pfifo_fast state UP qlen 1000\n    link/ether 7e:eb:9c:48:33:3c brd ff:ff:ff:ff:ff:ff\n    inet 192.168.42.1/24 brd 192.168.42.255 scope global usb0\n       valid_lft forever preferred_lft forever\n4: wlan0: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc mq state UP qlen 1000\n    link/ether 88:00:33:77:f1:0f brd ff:ff:ff:ff:ff:ff\n    inet 192.168.0.175/24 brd 192.168.0.255 scope global dynamic noprefixroute wlan0\n       valid_lft 84829sec preferred_lft 74029sec\n[root@milkv-duo]~# ping baidu.com\nPING baidu.com (39.156.66.10): 56 data bytes\n64 bytes from 39.156.66.10: seq=0 ttl=49 time=46.170 ms\n64 bytes from 39.156.66.10: seq=1 ttl=49 time=53.166 ms\n64 bytes from 39.156.66.10: seq=2 ttl=49 time=54.292 ms\n```\nAuto connect on startup\n\n```\ncat \u003e\u003e /mnt/system/duo-init.sh \u003c\u003cEND\n# Auto connect to WIFI on startup\nwpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf\nEND\nreboot\n```\n\n### Using a premade wpa_supplicant.conf\nSee files/wpa_supplicant.conf. Copy it over to the device \n```\ncp files/wpa_supplicant.conf ROOTFS/etc/wpa_supplicant.conf\n```\n## (WiFi/LAN) MAC changes everytime\n\n```\necho \"pre-up ifconfig eth0 hw ether 78:01:B3:FC:E8:55\" \u003e\u003e /etc/network/interfaces\necho \"pre-up ifconfig wlan0 hw ether 78:01:B3:FC:E8:55\" \u003e\u003e /etc/network/interfaces\n```\n\n## Colors are inverted\n\nThe display in this code uses 2 bytes per pixel. (BRG565)\nYours might use different color coding.\nUse `fb-set` to get the bits-per pixel, fetch your displays datasheet and change the code in \n`frame_buffer_display.rs` accordingly.\n\n## I dont see anything\n\nCheck your display connections and you might want to install `BR2_PACKAGE_FB_TEST_APP` into your buildroot to test the framebuffer device.\n\n## not found\n\n```\n[root@milkv-duo]~# ./hello_riscv \n-sh: ./hello_riscv: not found\n```\n\nCreate an symlink to correct the interpreter path used in the binary\n```\nln -sf /lib/ld-musl-riscv64v0p7_xthead.so.1 /lib/ld-musl-riscv64.so.1\n```\n\n## sftp-server not found\n```\nscp target/riscv64gc-unknown-linux-musl/release/hello_riscv root@192.168.XXX.YYY:~\nroot@192.168.XXX.YYY's password: \nsh: /usr/libexec/sftp-server: not found\nscp: Connection closed\n```\n\nYour ssh client is newer than on the host. Use the legacy options:\n```\nscp -O target/riscv64gc-unknown-linux-musl/release/hello_riscv root@192.168.XXX.YYY:~\n```\n\n## Why does my MilkV get a new MAC address and IP everytime\n\nYet unsure, i guess they didnt pay MACs.\nWhich could be why the MAC addr. are super random everytime.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiathedev%2Fmilkv-rust-hid-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiathedev%2Fmilkv-rust-hid-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiathedev%2Fmilkv-rust-hid-example/lists"}