Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Obok import in Calibre flatpak by using /sys/class/net/IFACE/address instead of ip #586

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jcotton42
Copy link

@jcotton42 jcotton42 commented Jul 30, 2024

Fixes #585 by using /sys/class/net/IFACE/address for the MAC address instead of the ip command. I left the old Linux method of ip and ipconfig as an ultimate fallback, but I'm not sure if it's going to be useful.

After making this change I was able to successfully import a DRM'd Kobo book from the Calibre flatpak. I should note I can only test in Calibre 7.

Use /sys/class/net/IFACE/address for the MAC address instead of the ip
command.
@jcotton42 jcotton42 changed the title Fix #585 by using /sys/class/net/IFACE/address instead of the ip command Fix Obok import in Calibre flatpak (#585) by using /sys/class/net/IFACE/address instead of ip Jul 30, 2024
@jcotton42 jcotton42 changed the title Fix Obok import in Calibre flatpak (#585) by using /sys/class/net/IFACE/address instead of ip Fix Obok import in Calibre flatpak by using /sys/class/net/IFACE/address instead of ip Jul 30, 2024
@@ -449,9 +449,15 @@ def __getmacaddrs (self):
for m in matches:
# print "m:{0}".format(m[0])
macaddrs.append(m[0].upper())
elif sys.platform.startswith('linux'):
for interface in os.listdir('/sys/class/net'):
with open('/sys/class/net/' + interface + '/address', 'r') as f:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used string concat here instead of f-strings because I wasn't sure if I could assume at least Python 3.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Obok relies on ip command to get MAC address, which is not available in the Calibre flatpak
1 participant