knowledge_base:programming:protobuf

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
knowledge_base:programming:protobuf [2022/12/02 15:58] – removed - external edit (Unknown date) 127.0.0.1knowledge_base:programming:protobuf [2022/12/02 15:58] (current) – ↷ Page moved from knowledge_base:home_it:protobuf to knowledge_base:programming:protobuf George Wayne
Line 1: Line 1:
 +====== Google Protocol Buffers for Python3 ======
 +
 +===== Install Protobuf Compiler =====
 +
 +  - Download protobuf binary and follow readme.txt - [[https://github.com/protocolbuffers/protobuf/releases/tag/v3.6.1|https://github.com/protocolbuffers/protobuf/releases/tag/v3.6.1]] (protoc-3.6.1-linux-x86_64.zip)
 +  - Install setuptools (sudo apt-get install python3-setuptools)
 +  - Download and install protobuf compiler - [[https://github.com/protocolbuffers/protobuf/releases/tag/v3.6.1|https://github.com/protocolbuffers/protobuf/releases/tag/v3.6.1]] (protobuf-python-3.6.1.zip), (sudo python3 setup.py install) setup.py is located in the python folder
 +
 +===== Python3 Protobuf Programming Basics =====
 +
 +  - Tutorial: [[https://developers.google.com/protocol-buffers/docs/pythontutorial|https://developers.google.com/protocol-buffers/docs/pythontutorial]]
 +
 +===== HCI Log Manipulation =====
 +
 +  - Get btsnoop_hci.log by turning on Android developer option
 +  - Use wireshark to extract RFCOMM payload
 +  - Rip protobuf from payload binary by ripping transport header (See AMA protocol spec for transport header details). I wrote a little python3 program called rippproto.py to do that
 +  - Parsing protobuf message. I wrote a little python3 program called listctl.py to do that
 +
 +===== Clipboard Access =====
 +
 +  - xclip requires x-server. VcXsrv (open source) or Xming (donation based) are two possible choices. VcXsrv is what I use.
 +  - subprocess package can run xclip (or any shell command) in Python3 and redirect input/output
 +
 +===== Bose Hack =====
 +<code>
 +thomwang@SJC-5CG7193RWZ:~/AMA_ProtoFiles$ ./onestep.py -x 100006085a4a020803
 +Version: 1
 +Stream Id: 0 - control stream
 +Payload Bytes: 6
 +command: GETFIRMWAREINFORMATION
 +response {
 +  error_code: UNSUPPORTED
 +}
 +
 +thomwang@SJC-5CG7193RWZ:~/AMA_ProtoFiles$ ./onestep.py -x 10003c08144a381a360a113037373036315a38313431313036334145120c426f736520514333352049491a03000102220e413259303451504643414e4c5051
 +Version: 1
 +Stream Id: 0 - control stream
 +Payload Bytes: 60
 +command: GET_DEVICE_INFORMATION
 +response {
 +  device_information {
 +    serial_number: "077061Z81411063AE"
 +    name: "Bose QC35 II"
 +    supported_transports: BLUETOOTH_LOW_ENERGY
 +    supported_transports: BLUETOOTH_RFCOMM
 +    supported_transports: BLUETOOTH_IAP
 +    device_type: "A2Y04QPFCANLPQ"
 +  }
 +}
 +
 +thomwang@SJC-5CG7193RWZ:~/AMA_ProtoFiles$ ./onestep.py -x 10000608154a025200
 +Version: 1
 +Stream Id: 0 - control stream
 +Payload Bytes: 6
 +command: GET_DEVICE_CONFIGURATION
 +response {
 +  device_configuration {
 +  }
 +}
 +
 +thomwang@SJC-5CG7193RWZ:~/AMA_ProtoFiles$ ./onestep.py -x 10000608324a020803
 +Version: 1
 +Stream Id: 0 - control stream
 +Payload Bytes: 6
 +command: SYNCHRONIZE_SETTINGS
 +response {
 +  error_code: UNSUPPORTED
 +}
 +</code>
 +