Fix a type error

Convert a string to a bytes object to avoid error message "TypeError: a bytes-like object is required, not 'str'"

BUG=None
TEST=Run start.py on DUT with no error messages

Change-Id: Ia163b2baae771402836355a0f7f1e4c4b698620e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/optofidelity_chromeos_touch_sender/+/4179064
Tested-by: Jingyuan Liang <jingyliang@chromium.org>
Commit-Queue: Jingyuan Liang <jingyliang@chromium.org>
Commit-Queue: Sean O'Brien <seobrien@chromium.org>
Auto-Submit: Jingyuan Liang <jingyliang@chromium.org>
Reviewed-by: Sean O'Brien <seobrien@chromium.org>
1 file changed
tree: 31bcde8f3728fb48b59aa3025d5f1cbfc1a3f4ae
  1. OF_Touch_Test_GUI/
  2. OptoFidelity_Touch_Test/
  3. .gitignore
  4. .gitmodules
  5. DUT_commands.txt
  6. LICENSE_chromiumos
  7. LICENSE_optofidelity
  8. OWNERS
  9. README.md
  10. start_DUT_measure.bat
  11. start_touch_test.conf
  12. unblocked_terms.txt
README.md

Chromium OS tap test app

This is repository of testing app for Chromium OS.

Python script reads kernel events from specified device and sends parsed information to server via socket.

GUI is Chromium OS application written in javascript. It creates a socket server to port 50008, to which the python app will try to connect. Using of GUI is optional, but recommended, since controlling and configurating the app is a lot easier with it.


Configuration

This section describes how to configure the program.

App configuration

The default configuration file of application may be found from config/default.cfg. The configuration file is read with ConfigParser. Section names are ignored and may be overwritten.

Available parameters are:

ip
port
device_path
max_tcp_freq
require_gui
client_id
  • Collected touch data is sent to defined IP-address and port.
  • Device path (e.g. /dev/input/event4) can be defined. If not, app will list devices to user and user will choose the device when launching the app.
  • Maximum TCP-packet sending frequency can be set with max_tcp_freq parameter. App will then send more data in one package and reduce traffic in network.
  • Require_gui is used to determine if the program should wait for GUI to connect and control the execution.
  • Client ID is used to differentiate DUTs connected to the same server. Each DUT should have a unique ID.
Mandatory parameters

If GUI is required, no parameter is mandatory. Necessary parameters are obtained from the device and GUI. Mandatory parameters (when running headless) are:

ip
Default parameters

Other parameters will get default values, if not defined in configuration file:

  • port = 50007
  • device_type = stylus
  • max_tcp_freq = 10
  • client_id = 0
Other
  • Device_path has no default, it will be asked from user if the script is started manually

Logger configuration

Logger configuration is read by default from file config/logging.json. It includes different loggers and their settings. By default, it will log with level DEBUG to file log/devicelog.log. Maximum size is 1MB and can be changed. 10 log files are saved and file rotation used. Size may be raised according to needs.


Usage

  1. Create or modify configuration files mentioned above config/default.cfg and config/logging.json.
  2. Copy folder OptoFidelity Touch Test to DUT home (~) folder.
    • Optional: Copy start_touch_test.conf to /etc/init/ to start python script when user logs in.
  3. Install GUI app to chrome at chrome://extensions
    • Option 1: Install OF Touch Test GUI.crx.
    • Option 2:
      • Make sure that Developer mode is on.
      • Load unpacked extension from the folder [OF Touch Test GUI](OF Touch Test GUI) you copied to DUT.
  4. Start app with command:
    python start.py [-c <path_to_your_config_file>] [-l <path_to_your_logging_conf>]
    For example:
    python start.py -c config/default.cfg -l config/logging.json
    
    • App parses option -c or --config as app configuration file.
    • Other parsed option is -l or --log_config which defines logging configuration file.
    • Help is printed with flag -h or --help
  • Launch the GUI application

Using the GUI

Chromium OS GUI app is quite similar to other OptoFidelity Touch Test applications. There are two input fields, one for ip and another for port number. These are used when DUT is connecting to Sequencer. In addition to those, the input device can be choosed from dropdown list. These devices are listed as /dev/input/event*.

After the GUI has connected to the background Python-script, the “Start testing” button will be enabled. Also the default ip and port will be inserted to according fields when default values are received from Python script.

After pushing the Start testing -button, DUT will connect to the Sequencer with given address and port.

Testing screen may be exited by swiping the screen with non-measured device. This means that if the stylus is tested, touching the screen with finger will stop measurement, and other way around. Measured device (eg. stylus device) cannot emit the touch events, since the device is grabbed to Python script. Thus only other devices will work.


Miscellaneous

  • Project should not depend on any libraries or modules that are not Python standard libraries.