get_devices() returns Error: UnsupportedDevice
Closed this issue · 3 comments
Expected Behavior
get_devices()
returns Error: UnsupportedDevice
on my laptop and phone
Actual Behavior
get_devices()
to return the devices that it knows
Steps to Reproduce the Problem
- Run the example program
Specifications
- Version: 0.3.2
- Platform: Arch Linux and Manjaro Linux (Both x86_64 and aarch64)
nmcli returns
wlp10s0: connected to ridecar2_5GHz
"Broadcom and subsidiaries BCM4352"
wifi (wl), 54:27:1E:30:01:C8, hw, mtu 1500
ip4 default
inet4 192.168.1.98/24
route4 0.0.0.0/0
route4 192.168.1.0/24
inet6 fe80::b31f:c942:f04c:66c5/64
route6 fe80::/64
route6 ff00::/8
docker0: connected (externally) to docker0
"docker0"
bridge, 02:42:DC:64:29:56, sw, mtu 1500
inet4 172.17.0.1/16
route4 172.17.0.0/16
inet6 fe80::42:dcff:fe64:2956/64
route6 fe80::/64
enp8s0: unavailable
"Qualcomm Atheros Killer E220x"
ethernet (alx), F0:1F:AF:6B:24:E2, hw, mtu 1500
lo: unmanaged
"lo"
loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
DNS configuration:
servers: 192.168.1.1
interface: wlp10s0
Hi @he4d,
I have the same issue as @garethhubball. Because many device_types are not implemented yet. To smooth the process, we should rewrite it with a more flexible approach.
impl<'a> Device<'a> {
pub(crate) fn new(dbus_accessor: DBusAccessor<'a>) -> Result<Self, Error> {
let dev_type = dbus_accessor.create_proxy().device_type()?;
match FromPrimitive::from_u32(dev_type) {
Some(x) => match x {
DeviceType::Wifi => Ok(Device::WiFi(WiFiDevice { dbus_accessor })),
DeviceType::Ethernet => Ok(Device::Ethernet(EthernetDevice { dbus_accessor })),
DeviceType::Generic => Ok(Device::Generic(GenericDevice { dbus_accessor })),
_ => Err(Error::UnsupportedDevice),
},
None => Err(Error::UnsupportedType),
}
}
}
@he4d what is the best approach with the push vector process? Ignore UnsupportedDevice or add an alternative option to accept UnsupportedDevice?
pub fn devices(&self) -> Result<Vec<Device>, Error> {
let device_paths = proxy!(self).devices()?;
let mut res = Vec::new();
for dev_path in device_paths {
res.push(Device::new(DBusAccessor::new(
self.dbus_accessor.connection,
&self.dbus_accessor.bus,
&dev_path,
))?);
}
Ok(res)
}
Hi @IniterWorker and @garethhubball
I am sorry but at the moment I don't have any time for this project.
I would like to invite you as collaborators if this is okay for both of you.
Let me know.
BR,
he4d
@he4d,
Of course, let's be humble, you don't need this package every day.
If you desire talk, I created a chat room in https://chat.mozilla.org/#/room/#networkmanager-rs:mozilla.org.
B. r