# Reading data from '/run/mpa/qvio' using python

Source: https://forum.modalai.com/topic/1242/reading-data-from-run-mpa-qvio-using-python
Category: VOXL SDK and Software (https://forum.modalai.com/category/47/voxl-sdk-and-software)
Tags: mpa
Posted: 2022-08-25 07:00:25 UTC by Nishkala
Replies: 3 · Views: 1451

## Nishkala · 2022-08-25 07:00:25 UTC

How can we read data from the pipe /run/mpa/qvio in python

## Reply by modaltb (ModalAI staff) · 2022-08-26 18:45:37 UTC

Hi @Nishkala ,

I haven't tried this yet, but it's just a file that you are reading from basically (a named pipe), so something like this may get you reading?  --> https://stackoverflow.com/questions/39089776/python-read-named-pipe

In order to parse what you are reading, you will need to use the C headers to see what bytes are what, which is shown here: https://gitlab.com/voxl-public/voxl-sdk/core-libs/libmodal-pipe/-/blob/master/library/include/modal_pipe_interfaces.h#L880

## Reply by Nishkala · 2022-08-31 09:31:55 UTC

@modaltb, the links provided were insightful

Before running a python script similar to the one provided in the [link](https://stackoverflow.com/questions/39089776/python-read-named-pipe), I executed the commands
1) 'cat run/mpa/qvio/info': I was able to see information pertaining to qvio.
2) 'cat run/mpa/qvio/control': I was able to see the message continuously printed related to 'reset_hard_qvio'
3) 'cat run/mpa/qvio/request': It was blank

Which pipe should be read to get data in the form of 'vio_data_t'?

## Reply by modaltb (ModalAI staff) · 2022-09-01 16:08:47 UTC

Hi @Nishkala ,

With the warning that I've not yet tried in python but I'm sure it will work ;)

This is the source code for our `voxl-inspect-qvio` tool, and from there we can see it's looking for a pipe `QVIO_EXTENDED_LOCATION`
https://gitlab.com/voxl-public/voxl-sdk/services/voxl-qvio-server/-/blob/master/clients/voxl-inspect-qvio.c#L51

That's defined here:
https://gitlab.com/voxl-public/voxl-sdk/services/voxl-qvio-server/-/blob/master/common/voxl_qvio_server.h#L64

The other place to look for defines is in libmodal-pipe:
https://gitlab.com/voxl-public/voxl-sdk/core-libs/libmodal-pipe/-/blob/master/library/include

This is where the inspect tool consumes data:
https://gitlab.com/voxl-public/voxl-sdk/services/voxl-qvio-server/-/blob/master/clients/voxl-inspect-qvio.c#L259

Here's where we parse and print the info:
https://gitlab.com/voxl-public/voxl-sdk/services/voxl-qvio-server/-/blob/master/clients/voxl-inspect-qvio.c#L184
