Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GNU Linux Hardware Emulation with Python

GNU Linux Hardware Emulation with Python

Talk: https://www.youtube.com/watch?v=UhLP0TJg5T8

With the kernel inotify feature, the D-Bus mocker library and the udev monitoring we try to detect the different events that occours when you're using a specific set of connected devices.

Then we try to mimic these devices investigating also the kernel drivers if necessary.

At the end we're ready to connect the simulation routines to our testing procedure.

Stefano Cotta Ramusino

July 22, 2014

More Decks by Stefano Cotta Ramusino

Other Decks in Programming


  1. OH NO!! WHAT CAN I DO? Do want to test

    your connection code
 with a WiFi/GSM network
 but you haven’t any dongle? Stefano Cotta Ramusino <[email protected]> Page 1/10
  2. OH NO!! WHAT CAN I DO? Do you want to

    check your software notification when battery is low
 but you’re testing your application
 on your desktop? Stefano Cotta Ramusino <[email protected]> Page 2/10
  3. OH NO!! WHAT CAN I DO? Do you want to

    manipulate the data coming from a device
 but you’ve lend it to someone else? Stefano Cotta Ramusino <[email protected]> Page 3/10
  4. YOU’RE MY SALVATION No problem
 you can emulate all

    these hardware with
 Python ! Stefano Cotta Ramusino <[email protected]> Page 4/10
  5. HARDWARE EMULATION Stefano Cotta Ramusino <[email protected]> Page 6/10 Kernel D-Bus

    Daemon inotify D-Bus Mock Emulated Hardware Software to Test
  6. D-BUS SERVICE class DBusService(dbus.service.Object):
 def __init__(self):
 name = dbus.service.BusName('test.service', bus

    = dbus.SessionBus())
 dbus.service.Object.__init__(self, bus_name, '/test/service')
 def hello(self):
 return 'Hello World!' Stefano Cotta Ramusino <[email protected]> Page 7/10
  7. D-BUS MOCK wifi = dbusmock.AddWiFiDevice('MyWiFi', 'wlan0', DeviceState.ACTIVATED)! dbusmock.AddAccessPoint(wifi, 'MyAcccessPoint', 'MyAP',

    '00:11:22:33:44:55', …)! dbusmock.AddWiFiConnection(wifi, 'MyConnection', 'MyAP', …) Stefano Cotta Ramusino <[email protected]> Page 8/10