Commit 850d5d22 authored by MLA98's avatar MLA98

Update device.rs

parent ca1d0b37
......@@ -94,6 +94,16 @@ const TD_CMD_IFCS: u8 = 1 << 1;
const TD_CMD_RS: u8 = 1 << 3;
const TD_DD: u8 = 1;
pub fn setnetcfg(key: &str, value: &str) -> Result<()> {
let mut file = File::create(&format!("/etc/net/eth0/{}", key))?;
file.write(value.as_bytes())?;
file.set_len(value.len() as u64)?;
file.sync_all()?;
Ok(())
}
pub struct Intel8254x {
base: usize,
receive_buffer: [Dma<[u8; 16384]>; 16],
......@@ -331,7 +341,7 @@ impl Intel8254x {
mac_high as u8,
(mac_high >> 8) as u8];
print!("{}", format!(" - MAC: {:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
let _ = setcfg("mac", &format!("{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
let _ = setnetcfg("mac", &format!("{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
//
// MTA => 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment