Hardware Reference
In-Depth Information
affect the bandwidth limits on your bridge. When the callback occurs, it will display the
new bandwidth rates on the LCD so that you know that your limit has changed. This call-
back is shown as follows:
def make_conf_callback(lcd):
'''Returns a callback function for the configuration
changed
event'''
def conf_changed(event):
'''Reads the new bandwidth rates from the bridge and
draws
that information to the display'''
rate = str(int(event.config['RelayBandwidthRate']) /
1024)
burst = str(int(event.config['RelayBandwidthBurst']) /
1024)
lcd.display_rates(rate, burst)
return conf_changed
The main section of the Python script performs the class instantiation and also displays a
one-time splash screen to the LCD. It will show the total bytes transmitted by the bridge,
the number of established circuits, and the last 24 bytes of the bridge's fingerprint. The
bridge controller will run forever, while the bandwidth knob is at a nonzero value. When
you dial the knob to zero, the program will exit and the LCD will be filled with blocks.
Finally, to run the bridge controller, execute the following command, with the first para-
meter being the location of the speed test results:
sudo python beaglebridge.py ~/speedtest.txt &
To avoid running as root, you'll have to manipulate user groups and permissions. The Tor
process runs as the debian-tor user, and the Adafruit library, which enables device
tree overlays on your behalf, needs to run at a user level that has the permission to enable
these features. You can create a custom group and a user that is in the debian-tor
group and then give that group permission to modify the device tree files to not run as
root.
Search WWH ::




Custom Search