| 1 |
# SPDX-License-Identifier: GPL-2.0-or-later |
| 2 |
|
| 3 |
""" |
| 4 |
Module for accessory methods |
| 5 |
""" |
| 6 |
from openrazer_daemon.dbus_services import endpoint |
| 7 |
|
| 8 |
|
| 9 |
@endpoint('razer.device.misc.mug', 'isMugPresent', out_sig='b') |
| 10 |
def is_mug_present(self): |
| 11 |
""" |
| 12 |
Get if the mug is present |
| 13 |
|
| 14 |
:return: True if there's a mug |
| 15 |
:rtype: bool |
| 16 |
""" |
| 17 |
self.logger.debug("DBus call is_mug_present") |
| 18 |
|
| 19 |
driver_path = self.get_driver_path('is_mug_present') |
| 20 |
|
| 21 |
with open(driver_path, 'r') as driver_file: |
| 22 |
return int(driver_file.read().strip()) == 1 |