[IMP] point_of_sale: New build for IoT v23_11
Adapts the build of the iot to meet the requirements of version 17 of Odoo notably python >=3.10 closes odoo/odoo#139226 X-original-commit: 81d42e38beec510a0971685d3e58dcdee8da7951 Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
This commit is contained in:
@@ -48,7 +48,7 @@ class EventManager(object):
|
||||
}
|
||||
self.events.append(event)
|
||||
for session in self.sessions:
|
||||
if device.device_identifier in self.sessions[session]['devices'] and not self.sessions[session]['event'].isSet():
|
||||
if device.device_identifier in self.sessions[session]['devices'] and not self.sessions[session]['event'].is_set():
|
||||
self.sessions[session]['result'] = event
|
||||
self.sessions[session]['event'].set()
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class DisplayDriver(Driver):
|
||||
return len(displays) and iot_devices[displays[0]]
|
||||
|
||||
def run(self):
|
||||
while self.device_identifier != 'distant_display' and not self._stopped.isSet():
|
||||
while self.device_identifier != 'distant_display' and not self._stopped.is_set():
|
||||
time.sleep(60)
|
||||
if self.url != 'http://localhost:8069/point_of_sale/display/' + self.device_identifier:
|
||||
# Refresh the page every minute
|
||||
|
||||
@@ -127,7 +127,7 @@ class KeyboardUSBDriver(Driver):
|
||||
def run(self):
|
||||
try:
|
||||
for event in self.input_device.read_loop():
|
||||
if self._stopped.isSet():
|
||||
if self._stopped.is_set():
|
||||
break
|
||||
if event.type == evdev.ecodes.EV_KEY:
|
||||
data = evdev.categorize(event)
|
||||
|
||||
@@ -134,7 +134,7 @@ class SerialDriver(Driver):
|
||||
self._connection = connection
|
||||
self._status['status'] = self.STATUS_CONNECTED
|
||||
self._push_status()
|
||||
while not self._stopped.isSet():
|
||||
while not self._stopped.is_set():
|
||||
self._take_measure()
|
||||
time.sleep(self._protocol.newMeasureDelay)
|
||||
except Exception:
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
from re import sub, finditer
|
||||
import subprocess
|
||||
from vcgencmd import Vcgencmd
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
from odoo.addons.hw_drivers.interface import Interface
|
||||
|
||||
@@ -13,20 +15,22 @@ class DisplayInterface(Interface):
|
||||
|
||||
def get_devices(self):
|
||||
display_devices = {}
|
||||
displays = subprocess.check_output(['tvservice', '-l']).decode()
|
||||
x_screen = 0
|
||||
for match in finditer('Display Number (\d), type HDMI (\d)', displays):
|
||||
display_id, hdmi_id = match.groups()
|
||||
tvservice_output = subprocess.check_output(['tvservice', '-nv', display_id]).decode().strip()
|
||||
if tvservice_output:
|
||||
display_name = tvservice_output.split('=')[1]
|
||||
display_identifier = sub('[^a-zA-Z0-9 ]+', '', display_name).replace(' ', '_') + "_" + str(hdmi_id)
|
||||
hdmi_port = {'hdmi_0' : 2}
|
||||
rpi_type = GPIO.RPI_INFO.get('TYPE')
|
||||
# RPI 3B+ response on for booth hdmi port
|
||||
if 'Pi 4' in rpi_type:
|
||||
hdmi_port.update({'hdmi_1': 7})
|
||||
|
||||
for hdmi in hdmi_port:
|
||||
power_state_hdmi = Vcgencmd().display_power_state(hdmi_port.get(hdmi))
|
||||
if power_state_hdmi == 'on':
|
||||
iot_device = {
|
||||
'identifier': display_identifier,
|
||||
'name': display_name,
|
||||
'identifier': hdmi,
|
||||
'name': 'Display hdmi ' + str(x_screen),
|
||||
'x_screen': str(x_screen),
|
||||
}
|
||||
display_devices[display_identifier] = iot_device
|
||||
display_devices[hdmi] = iot_device
|
||||
x_screen += 1
|
||||
|
||||
if not len(display_devices):
|
||||
|
||||
@@ -80,8 +80,10 @@ PKGS_TO_INSTALL="
|
||||
python3-tz \
|
||||
python3-urllib3 \
|
||||
python3-werkzeug \
|
||||
python3-venv \
|
||||
rsync \
|
||||
screen \
|
||||
swig \
|
||||
unclutter \
|
||||
vim \
|
||||
x11-utils \
|
||||
@@ -114,9 +116,15 @@ PIP_TO_INSTALL="
|
||||
v4l2 \
|
||||
pysmb==1.2.9.1 \
|
||||
cryptocode==0.1 \
|
||||
PyKCS11 \
|
||||
vcgencmd \
|
||||
RPi.GPIO \
|
||||
rjsmin==1.1.0"
|
||||
|
||||
pip3 install ${PIP_TO_INSTALL}
|
||||
mkdir venv
|
||||
python3 -m venv venv
|
||||
venv/bin/pip3 install ${PIP_TO_INSTALL}
|
||||
rsync -avrhp venv/lib/python3.11/site-packages/* /usr/lib/python3/dist-packages/
|
||||
|
||||
# Dowload MPD server and library for Six terminals
|
||||
wget 'https://nightly.odoo.com/master/iotbox/eftdvs' -P /usr/local/bin/
|
||||
|
||||
@@ -29,11 +29,11 @@ MOUNT_POINT="${__dir}/root_mount"
|
||||
OVERWRITE_FILES_BEFORE_INIT_DIR="${__dir}/overwrite_before_init"
|
||||
OVERWRITE_FILES_AFTER_INIT_DIR="${__dir}/overwrite_after_init"
|
||||
VERSION=16.0
|
||||
VERSION_IOTBOX=23.09
|
||||
VERSION_IOTBOX=23.11
|
||||
REPO=https://github.com/odoo/odoo.git
|
||||
|
||||
if ! file_exists *raspios*.img ; then
|
||||
wget 'https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-05-03/2023-05-03-raspios-bullseye-armhf-lite.img.xz' -O raspios.img.xz
|
||||
wget 'https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-10-10/2023-10-10-raspios-bookworm-armhf-lite.img.xz' -O raspios.img.xz
|
||||
unxz --verbose raspios.img.xz
|
||||
fi
|
||||
|
||||
@@ -129,7 +129,7 @@ cp -v "${QEMU_ARM_STATIC}" "${MOUNT_POINT}/usr/bin/"
|
||||
|
||||
# 'overlay' the overwrite directory onto the mounted image filesystem
|
||||
cp -av "${OVERWRITE_FILES_BEFORE_INIT_DIR}"/* "${MOUNT_POINT}"
|
||||
chroot "${MOUNT_POINT}" /bin/bash -c "sudo /etc/init_posbox_image.sh"
|
||||
chroot "${MOUNT_POINT}" /bin/bash -c "/etc/init_posbox_image.sh"
|
||||
|
||||
# copy iotbox version
|
||||
mkdir -pv "${MOUNT_POINT}"/var/odoo
|
||||
@@ -151,7 +151,7 @@ done
|
||||
|
||||
# cleanup
|
||||
umount -fv "${MOUNT_POINT}"/boot/
|
||||
umount -fv "${MOUNT_POINT}"/
|
||||
umount -lv "${MOUNT_POINT}"/
|
||||
rm -rfv "${MOUNT_POINT}"
|
||||
|
||||
echo "Running zerofree..."
|
||||
|
||||
Reference in New Issue
Block a user