Richard Acayan aaa0e65c2d fastrpc: treat returned length as a normal number (BREAKING CHANGE)
A FastRPC function call does not necessarily return the amount of bytes
written in the output buffer. Implementing a field that makes these
sizes optional would require the function to keep track of the returned
sizes separately from any other output from this function. Since
returned lengths are interleaved and at the last part of the argument
list, it already needs an unnecessary pass to write back the lengths.
Move the returned lengths to the "returned numbers" part of the argument
list and assume that they are counted in the out_nums property of the
function definition.

The (maximum) sizes of the buffers should still be handled separately
because they need to be passed both to the kernel and to the remote
processor. Removing this special handling would just duplicate the size
arguments, while its implementation is more maintainable than the
returned lengths. The kernel API would need to change for this separate
handling to be unnecessary. Therefore, it is useless to introduce any
other breaking change while old code is already broken.
2023-01-04 22:50:21 -05:00
2023-01-02 18:51:58 -05:00
2023-01-02 18:51:58 -05:00
2023-01-02 18:51:58 -05:00
2023-01-02 18:51:58 -05:00
2023-01-04 00:38:15 -05:00
2023-01-02 18:51:58 -05:00

This is a proof-of-concept for interacting with the Snapdragon Sensor Core using the reverse-engineered protocol buffers. It was made to try to initialize it, but the Pixel 3a is missing some sensors once the firmware is loaded.

A best effort is made to prefix all log messages with sensh: so it's clear which lines were entered by the user.

Requirements

Installation

There is a Makefile to compile this:

$ make

Usage

Sensh doesn't automatically track, probe, or look up sensors; that is for a full implementation. Instead, it expects you to look up the sensor and copy the ID with your terminal emulator:

lookup accel_cal
sensh: accel_cal sensor found: A1392FDF217B7D9EI6648AED8C04DDFB9
attr A1392FDF217B7D9EI6648AED8C04DDFB9
sensh: name: ASH_CAL
sensh: vendor: GOOGLE
sensh: type: accel_cal
sensh: version: 1
sensh: api: sns_cal.proto
sensh: rates: 10.000000
sensh: stream type: 1
sensh: physical sensor: 0
sensh: available: 1

You can send 3 messages: lookup, attr, and watch. The lookup command returns SUIDs for the passed data type. The attr command returns attributes for the sensor. Finally, the watch command tells the sensor core to send events from a sensor whenever the sensor's value changes. The watch command is only valid if the stream type is 1 or 2.

An EOF (normally Ctrl+D) is enough to exit the shell unless the sensor core died.

References

The following sources were used as reference:

Description
No description provided
Readme 361 KiB
Languages
C 96%
Meson 2.2%
Roff 1.8%