mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-17 15:12:48 +00:00
25 lines
668 B
Python
Executable File
25 lines
668 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
# Copyright (C) 2015 Richard Hughes <richard@hughsie.com>
|
|
# Licensed under the GNU General Public License Version 2
|
|
|
|
import gi
|
|
gi.require_version('Dfu', '1.0')
|
|
|
|
from gi.repository import Dfu
|
|
from gi.repository import Gio
|
|
|
|
cancellable = Gio.Cancellable.new()
|
|
ctx = Dfu.Context.new()
|
|
ctx.enumerate()
|
|
|
|
for dev in ctx.get_devices():
|
|
|
|
# print details about the device
|
|
dev.open(Dfu.DeviceOpenFlags.NONE, cancellable)
|
|
print "getting firmware from %s:%s" % (dev.get_state(), dev.get_status())
|
|
|
|
# transfer firmware from device to host and show summary
|
|
fw = dev.upload(Dfu.TargetTransferFlags.DETACH, cancellable)
|
|
print fw.to_string()
|