Commit Graph
22 Commits
Author SHA1 Message Date
lejeune quentin b4920bfe55 [FIX] hw_drivers: Hide hostapd status in IoT
We call the status of the hostapd in each request of 'get_odoo_server_url()' and 'get_ssid()'
And this call display in the log the status '0' or 'inactive' in the log

With this commit we hide this useless information

closes odoo/odoo#72133

X-original-commit: e5e9f9f91cf9bf35f1e0b307008840a0de134e2f
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2021-06-14 13:13:32 +00:00
Antoine Prieels 2f7f9095d7 [FIX] hw_drivers: Don't crash if remount fails
We sometimes encountered IoT Boxes crashing because the remount failed.
As this isn't a big issue, we won't check the return value of the call
to `mount`.

closes odoo/odoo#59438

X-original-commit: 5f9874da0f5f5b27c546cd248d08299f0e65544b
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
2020-10-07 15:44:11 +00:00
lejeune quentin c5f46533dd [FIX] point_of_sale: Fix path to nightly in IoT
The path to folder of images of IoT has change.

So we adapt the path for the upgrade of IoT

closes odoo/odoo#57978

X-original-commit: 9512a23f48176fe0e7970039c824281c4af18162
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2020-09-17 16:14:13 +00:00
Antoine Prieels 72681dc53f [IMP] hw_*,point_of_sale: Cleaning IoT Box
- Split driver.py to multiple files
- Remove hw_proxy module as most of its routes were not used and
  move remaingin routes to a controller in hw_drivers
- Add missing coding and license lines at the beginning of files
- Reorder imports and remove unused ones
- Rename device_id to device_identifier for clarity
- Rename screen to display for consistency
- Other minors improvements

Taskid: 1973956
X-original-commit: 841c016913a87133bf7257c62ae5f6bf7d99e06d
2020-08-25 11:24:56 +00:00
Antoine Prieels 6c97a9eb60 [FIX] hw_drivers, pos: Move IoTBox version file
We move the IoT Box version file from /home/pi to /var/odoo
so its not overriden after an auto-flash of the IoT Box.

closes odoo/odoo#54063

X-original-commit: ce0700ce401523267b5a8bd5665a368cfea24912
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2020-07-03 15:18:03 +00:00
lejeune quentin 9553871312 [FIX] hw_drivers: Restart Odoo after IoT has connected
When the route '/hw_drivers/box/connect' is called to connect an IoT Box to a DB,
the checkout on the branch of the DB is not performed and incompatibility can occur.

With this fix we relaunch Odoo via a parallel thread in order to be able to respond to the request...

closes odoo/odoo#52513

X-original-commit: 9aca7c464cef492c495a0c72d870b7075187dc63
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2020-06-05 14:00:06 +00:00
Antoine Prieels ec9759a6c0 [FIX] hw_drivers: Failed checkout and drivers loading
- The checkout to switch to the branch of the connected DB was not
processed correctly because the command used to clear the drivers
failed, raising an exception:

rm: cannot remove '/home/pi/odoo/addons/hw_drivers/drivers/__pycache__': Is a directory

- The location of the drivers has been changed in master. So, even if we
perform a checkout, the addons/hw_drivers/drivers directory doesn't
exist. The get_resource_path('hw_drivers', 'drivers') then returned
False instead of the correct path and the extraction of the zip file
failed.

closes odoo/odoo#52448

Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2020-06-05 06:32:18 +00:00
Antoine Prieels e1c52c936d [IMP] hw_drivers: Easier detection of new devices
Until now, to detect new types of devices on the IoT Box, we had to
modify driver.py. If partners wanted to connect a new type of device,
they had to modify directly the files on the Box, meaning that after
each new build they had to re-apply all their modifications.

We remove the loops that detected the connected devices and replace
them by `Interfaces`. All interfaces will be loaded from the connected
Odoo instance with the corresponding drivers.

TaskID: 2082282
2020-05-13 13:26:05 +00:00
lejeune quentin 672323037a [FIX] hw_drivers: Clean drivers folder before change branch
When we change the version of branch we keep drivers.
But drivers are not compatible with all branch and Odoo
on the IoT Box can't start.

So we remove all drivers before checkout on another branch

closes odoo/odoo#50140

X-original-commit: 4e97aec6717697c742e5e0b09f00ab7dec09712f
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-04-24 11:10:12 +00:00
lejeune quentin 17c181ac74 [FIX] hw_drievrs: Replace SSID on the first boot
We replace the SSID of the IoTBox with a unique SSID

closes odoo/odoo#46255

X-original-commit: c847c1cb149e386331ff2e5b19a58862e1b66714
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2020-02-25 14:08:49 +00:00
lejeune quentin fff277a4a7 [FIX] hw_drivers: Do not send request if the IoT is in access point
If IoT Box is in access point mode and a server is configured
the box try to reach the server.
But in access point mode all requests are redirected to the box

So now before return True in function 'get_odoo_server_url'
we verify if the service 'hostapd' is inactive

closes odoo/odoo#46141

X-original-commit: 365f0e384630bad16e0872d2307702fca5a4e295
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2020-02-24 16:03:12 +00:00
lejeune quentin e8611b363a [IMP] point_of_sale: Add the possibility to the IoT Box to perform a self-flashing
To be able to flash the partition on which the IoT Box is executed,
we must create a third partition and install an OS there to be able
to boot on it and flash the partition of the IoT Box

- Creation of the third partition
- Raspbian download and checksum verification
- Installation of Raspbian on the third partition
- Download the IoT image on the Raspbian partition and check the checksum
- Reboot on the Raspbian partition
- Installation of the IoT image on the second partition
- Reboot on the IoT partition
- Cleaning and deleting the third partition

closes odoo/odoo#44430

Task: 2161955
X-original-commit: 407d9a88a3d23ed49ed5a2c5fa4d211cec43edfd
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2020-01-31 18:34:02 +00:00
Antoine Prieels 6e07e0b4b0 [FIX] hw_drivers: Use branch of connected DB
Preivously, the code of the IoT Box was retrieved from the branch that
was used during the build but the drivers were retrieved from the
connected Odoo DB. Both could be in different versions, which forced
used to make old drivers compatible with the new Box or new drivers
compatible with old versions of the Box.

All of this made it quite hard to modify the existing code, even for
new versions of the Box in master.

When connecting the IoT Box to an Odoo DB, we now retrieve the version
of Odoo that is used and checkout the Box to this branch. This means
that we can now modify the code of the Box in master without having to
worry about users using the latest build with older DBs.

Taskid: 2120749
X-original-commit: 6af5d669593a4f431d14fce08c6151932f97da82
2019-11-26 12:31:37 +00:00
lejeune quentin 5caa5d7d2e [IMP] hw_drivers: Change IoT Box version
Change the version of the IoT Box.
From 19_10 to 19_12

closes odoo/odoo#41109

X-original-commit: 2b8779dc657a5a2b877ad2a552dd0dfda0071357
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2019-11-29 10:23:15 +00:00
lejeune quentin 5d7e0b3735 [IMP] hw_drivers: Change version of IoT Box
We update the version of the build for IoT Box

closes odoo/odoo#38328

X-original-commit: be464a3759a4fe395334a1b26b90f7395e031d1a
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2019-10-10 06:31:41 +00:00
Antoine Prieels 9fff495927 [FIX] hw_drivers: Fix get_wifi_essid helper
The `get_wifi_essid` function was moved to the helpers file, but the
`self` argument was not removed from the function's signature.

closes odoo/odoo#36710

Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
2019-09-11 13:47:36 +00:00
lejeune quentin d4fa24c2bc [IMP] hw_drivers: Add possibility to choose a wifi network on IoT Box
Previously if you are wired connected we don't scan wifi network.

Now we scan the wifi network and add possibiliyt to select a network and use them.
2019-09-10 14:14:27 +00:00
lejeune quentin 9c10d7a28e [FIX] hw_drivers: Fix unmount of cups folder
To add or modify printer the /root_bypass_ramdisks/etc/cups/ need be writeable.
And /root_bypass_ramdisks/etc/cups/ = /etc/cups/
But when we make 'sudo mount -o remount,ro /' we put the /etc/cups/ and so
/root_bypass_ramdisks/etc/cups/ folder on read-only.

After all 'read-only' command we make another command to put cups folder writeable
2019-09-10 14:14:27 +00:00
Antoine Prieels 70006311d0 [IMP] hw_drivers, hw_posbox_homepage: get_ssid helper
Create a helper to get the ssid of the wifi to which the Box is
connected.
2019-09-04 13:10:03 +00:00
Antoine Prieels 2a7454ea6c [IMP] hw_{drivers, posbox_homepage}: Automatic load of drivers
Automatically load the IoT Drivers when Odoo starts on the IoT Box or
when the connection to the Odoo instance is done.

Allow to deactivate the automatic load to avoid overriding
modifications made on the Box.

TaskID: 2009683
2019-09-03 13:53:19 +00:00
lejeune quentin 2af13429cf [ADD] iot: Load a true certificate on IoT Box
With this commit we add the possibility to save the db_uuid and enterprise_code on the IoT Box.
We check the current SSL certificate and if it is not authenticated or not up to date
we send a request to 'https://www.odoo.com/odoo-enterprise/iot/x509'
with the db_uuid and enterprise_code to get the certificate, key, and domain associated with the client.
The IoT Box will be accessible in HTTPS according to the following domain:

https://<ip-with-dashes>.<sub-hash>.odoo-iot.com

<ip-with-dashes> being the ip address with dashes
<sub-hash> being a subdomain assigned by Odoo to a customer

Task: 1931770
2019-08-23 12:21:03 +02:00
lejeune quentin 84de7cbcb6 [ADD] iot: Improve usage of helpers in IoT Box
With this commit we move the helpers to a separate file for
easier access from the IoT Box
2019-08-23 12:21:02 +02:00