themactep / thingino-firmware

Open-source firmware for Ingenic SoC IP cameras
https://thingino.com
MIT License
79 stars 28 forks source link

portal issues when accessed through ethernet #115

Closed jayfan0 closed 4 weeks ago

jayfan0 commented 1 month ago

The initial configuration portal is designed to be accessed via an access point on a different ip to the normal camera operation.

However if the device has an ethernet connection at e.g. 192.168.1.15, the first access to this ip opens the portal. but this is causing issues between a normal firefox browser window and a private window.

The portal should be skipped altogether if a valid ethernet connection is active or the portal is not accessed through its own IPaddress/ network

gtxaspec commented 1 month ago

@themactep what do you think? should we have an option to disable portal for wired + wireless devices? or some other switch somewhere maybe an option when eth0 + wlan0 is detected that pops up on the portal to disable wifi + reboot?

themactep commented 1 month ago

i think that portal should only be available via the dedicated access point. otherwise, changes can be done from a regular web ui over ethernet.

themactep commented 1 month ago

check for ethernel in S41portal and exit if found. i think that's the most proper solution.

themactep commented 1 month ago

check this out https://github.com/themactep/thingino-firmware/compare/master...no-portal-with-eth

themactep commented 1 month ago

i do not have a dual port camera to test, so please test it out and report back.

jayfan0 commented 1 month ago

Here are some test results.

Summary Works as expected when using ethernet provided wlandev is undefined. Does not work if want to use wlan as eth0 interface is always there

Test Results

(note i did firstboot and deleted boot_complete from uboot on the device, and cleared site history and cache on every run)

disable_eth wlandev ethernet cable connected thingino AP Result
false undefined yes no normal browser window - .154 asks me to log in the webui password change.

private window - same as above

Basically works as expected
false undefined no no no web access (obviously)

connecting ethernet cable after result in same as above
false 8188fu yes no normal browser window - .154 take me to 404

private window - takes me to portal
false 8188fu no no no web access

connecting ethernet afterwards is same portal/ 404 as above
true undefined yes no no web access. DHCP ip was not given, however eth0 interface still exists in ip a and ifconfig
true undefined no no no web access. same result as above after connecting cable
true 8188fu yes no no web access. eth0 still shows under ifconfig
true 8188fu no no no web access. eth0 still shows under ifconfig

logread for the last configuration: (incorrect dates set from the "failsafe system time" on boot)

[root@ing-customPTZ--d5c4 ~]# logread
Jan  1 00:00:04 thingino-t21n syslog.info syslogd started: BusyBox v1.36.1
Jan  1 00:00:04 thingino-t21n daemon.info /etc/init.d/S01syslogd: Starting syslogd OK
Jan  1 00:00:04 thingino-t21n daemon.info datetime[640]: Set TZ to GMT0BST,M3.5.0/1,M10.5.0 (Europe/London)
Jan  1 00:00:04 thingino-t21n daemon.info /etc/init.d/S02datetime: Starting datetime OK
Jun 18 16:39:16 thingino-t21n daemon.info datetime[640]: Set fail-safe system time to: Tue Jun 18 16:39:16 BST 2024
Jun 18 16:39:16 thingino-t21n daemon.info /etc/init.d/S02datetime: Set TZ to GMT0BST,M3.5.0/1,M10.5.0 (Europe/London)
Jun 18 16:39:16 thingino-t21n daemon.info /etc/init.d/S02datetime: Set fail-safe system time to: Tue Jun 18 16:39:16 BST 2024
Jun 18 16:39:16 thingino-t21n kern.info sysctl: * Applying /etc/sysctl.conf ...
Jun 18 16:39:16 thingino-t21n kern.info sysctl: kernel.printk = 3 3 1 3
Jun 18 16:39:16 thingino-t21n daemon.info /etc/init.d/S02sysctl: Running sysctl: OK
Jun 18 16:39:16 thingino-t21n daemon.info /etc/init.d/S03environment: Starting environment OK
Jun 18 16:39:16 thingino-t21n daemon.info /etc/init.d/S04hostname: Starting hostname OK
Jun 18 16:39:16 thingino-t21n daemon.info /etc/init.d/S05gpio: Starting gpio OK
Jun 18 16:39:17 thingino-t21n daemon.info /etc/init.d/S06ircut: Starting ircut OK
Jun 18 16:39:17 thingino-t21n daemon.info mmc[898]: /proc/jz/mdio directory exists, MSC1 disabled... 
Jun 18 16:39:17 thingino-t21n daemon.info /etc/init.d/S09mmc: Starting mmc OK
Jun 18 16:39:17 thingino-t21n daemon.info /etc/init.d/S09motor: Starting motor OK
Jun 18 16:39:17 thingino-t21n daemon.info /etc/init.d/S10modules: Starting modules ...
Jun 18 16:39:18 thingino-t21n daemon.info /etc/init.d/S10modules: exfat OK
Jun 18 16:39:18 thingino-t21n daemon.info /etc/init.d/S10modules: audio OK
Jun 18 16:39:18 thingino-t21n daemon.info /etc/init.d/S10modules: tx_isp_t21 OK
Jun 18 16:39:18 thingino-t21n daemon.info /etc/init.d/S10modules: sensor_jxf23_t21 OK
Jun 18 16:39:18 thingino-t21n daemon.info /etc/init.d/S21rngd: Starting rngd OK
Jun 18 16:39:19 thingino-t21n daemon.info /etc/init.d/S30mdev: Starting mdev OK
Jun 18 16:39:19 thingino-t21n daemon.info /etc/init.d/S36wireless: Starting wireless ...
Jun 18 16:39:19 thingino-t21n daemon.info /etc/init.d/S36wireless: Send INSERT to MMC1 OK
Jun 18 16:39:19 thingino-t21n daemon.info automount: Failed to unmount /mnt/mmcblk0p1
Jun 18 16:39:19 thingino-t21n daemon.info automount: Failed to remove directory /mnt/mmcblk0p1
Jun 18 16:39:19 thingino-t21n daemon.warn automount: fsck (busybox 1.36.1)
Jun 18 16:39:19 thingino-t21n daemon.info automount: fsck check succeeded on /dev/mmcblk0p1
Jun 18 16:39:19 thingino-t21n daemon.info automount: Mounted /dev/mmcblk0p1 at /mnt/mmcblk0p1
Jun 18 16:39:20 thingino-t21n daemon.info /etc/init.d/S36wireless: Load module 8188fu OK
Jun 18 16:39:23 thingino-t21n daemon.info /etc/init.d/S36wireless: Set MAC address 02:a5:e7:6a:d5:c4 OK
Jun 18 16:39:23 thingino-t21n daemon.info wpa_supplicant[1175]: Interface 'wlan0' exists.
Jun 18 16:39:23 thingino-t21n daemon.info /etc/init.d/S38wpa_supplicant: Starting wpa_supplicant WiFi credentials missing
Jun 18 16:39:23 thingino-t21n daemon.info network[1199]: udhcpc: started, v1.36.1
Jun 18 16:39:23 thingino-t21n daemon.info udhcpc[1213]: started, v1.36.1
Jun 18 16:39:23 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:23 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:25 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:25 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:26 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:26 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:27 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:27 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:28 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:28 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:29 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:29 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:30 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:30 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:31 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:31 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:32 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:32 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:33 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:33 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:34 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:34 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:35 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:35 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:36 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:36 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:37 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:37 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:39 thingino-t21n daemon.info network[1199]: udhcpc: broadcasting discover
Jun 18 16:39:39 thingino-t21n daemon.info udhcpc[1213]: broadcasting discover
Jun 18 16:39:40 thingino-t21n daemon.info udhcpc[1213]: no lease, forking to background
Jun 18 16:39:40 thingino-t21n daemon.info network[1199]: udhcpc: no lease, forking to background
Jun 18 16:39:40 thingino-t21n daemon.info network[1199]: ip: SIOCGIFFLAGS: No such device
Jun 18 16:39:40 thingino-t21n daemon.info /etc/init.d/S40network: Starting network OK
Jun 18 16:39:40 thingino-t21n daemon.info portal[1254]: Interface 'eth0' exists.
Jun 18 16:39:40 thingino-t21n daemon.info /etc/init.d/S44devmounts: Starting devmounts No IP set
Jun 18 16:39:40 thingino-t21n daemon.info /etc/init.d/S49ntpd: Starting ntpd OK
Jun 18 16:39:40 thingino-t21n daemon.info /etc/init.d/S50dropbear: Starting dropbear OK
Jun 18 16:39:40 thingino-t21n authpriv.warn dropbear[1313]: Failed loading /etc/dropbear/dropbear_rsa_host_key
Jun 18 16:39:40 thingino-t21n authpriv.warn dropbear[1313]: Failed loading /etc/dropbear/dropbear_ecdsa_host_key
Jun 18 16:39:40 thingino-t21n authpriv.info dropbear[1338]: Running in background
Jun 18 16:39:40 thingino-t21n daemon.info /etc/init.d/S50httpd: Starting httpd OK
Jun 18 16:39:40 thingino-t21n daemon.info /etc/init.d/S50mosquitto: Starting mosquitto OK
Jun 18 16:39:40 thingino-t21n cron.info crond[1381]: crond (busybox 1.36.1) started, log level 8
Jun 18 16:39:40 thingino-t21n daemon.info /etc/init.d/S60crond: Starting crond OK
Jun 18 16:39:40 thingino-t21n daemon.info /etc/init.d/S93telegrambot: Starting telegrambot OK
Jun 18 16:39:41 thingino-t21n daemon.info /etc/init.d/S94rc.local: Running /etc/rc.local...
Jun 18 16:39:41 thingino-t21n daemon.info /etc/init.d/S94rc.local: Ciao
Jun 18 16:39:41 thingino-t21n daemon.info /etc/init.d/S95prudynt: Starting prudynt OK
Jun 18 16:39:41 thingino-t21n daemon.info /etc/init.d/S96iad: Starting iad OK
Jun 18 16:39:41 thingino-t21n daemon.info /etc/init.d/S96impconfig: Starting impconfig ...
Jun 18 16:39:43 thingino-t21n user.debug : [DEBUG:Config.cpp]: Failed to load prudynt configuration file from binary directory. Trying /etc...
Jun 18 16:39:43 thingino-t21n user.info : [INFO:Config.cpp]: Loaded configuration from /etc/prudynt.cfg
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for rtsp.auth_required, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.enabled, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.logo_enabled, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.time_enabled, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.user_text_enabled, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.font_stroke_enabled, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.uptime_display_enabled, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream1.jpeg_enabled, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.scale_enabled, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for rtsp.username, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for rtsp.password, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for rtsp.name, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.format, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.rtsp_endpoint, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.font_path, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.time_format, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.uptime_display_format, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.user_text_string, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream1.jpeg_path, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.logo_path, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.script_path, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for rtsp.port, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for rtsp.est_bitrate, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for rtsp.out_buffer_size, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for rtsp.send_buffer_size, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.gop, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.max_gop, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.fps, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.bitrate, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_pos_time_x, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_pos_time_y, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_pos_user_text_x, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_pos_user_text_y, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_pos_uptime_x, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_pos_uptime_y, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_pos_logo_x, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_pos_logo_y, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.osd_logo_transparency, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.rotation, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.scale_width, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream0.scale_height, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream1.jpeg_quality, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for stream1.jpeg_refresh, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.font_size, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.font_stroke_size, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.logo_height, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.logo_width, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.debounce_time, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.post_time, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.init_time, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.skip_frame_count, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.frame_width, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.frame_height, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.roi_0_x, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.roi_0_y, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.roi_1_x, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.roi_1_y, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for motion.roi_count, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.font_color, using default.
Jun 18 16:39:43 thingino-t21n user.warn : [WARN:Config.cpp]: Missing configuration for osd.font_stroke_color, using default.
Jun 18 16:39:43 thingino-t21n user.info : [INFO:main.cpp]: PRUDYNT Video Daemon: Jun 18 2024 15:39:16_3da6966970
Jun 18 16:39:43 thingino-t21n user.debug prudynt[1457]: [DEBUG:Logger.cpp]: Logger Init.
Jun 18 16:39:43 thingino-t21n user.info prudynt[1457]: [INFO:main.cpp]: Starting Prudynt Video Server.
Jun 18 16:39:43 thingino-t21n user.info prudynt[1457]: [INFO:IMP.cpp]: LIBIMP Version IMP-1.0.33
Jun 18 16:39:43 thingino-t21n user.info prudynt[1457]: [INFO:IMP.cpp]: SYSUTILS Version: SYSUTILS-1.0.33
Jun 18 16:39:43 thingino-t21n user.info prudynt[1457]: [INFO:IMP.cpp]: CPU Information: T21-N
Jun 18 16:39:43 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_OSD_SetPoolSize == 131072
Jun 18 16:39:43 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: ISP Opened!
Jun 18 16:39:43 thingino-t21n user.info prudynt[1457]: [INFO:IMP.cpp]: Sensor: jxf23
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: Sensor Added
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: Sensor Enabled
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP System Initialized
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_ISP_EnableTuning enabled
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: ISP Tuning Defaults set
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_ISP_Tuning_SetSensorFPS == 30
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_ISP_Tuning_SetISPRunningMode == 0
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_FrameSource_CreateChn created
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_FrameSource_SetChnAttr set
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_FrameSource_GetChnFifoAttr set
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_FrameSource_SetChnFifoAttr set
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:IMP.cpp]: IMP_FrameSource_SetFrameDepth set
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: Encoder Group created
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: Encoder Channel 0 created
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: Encoder Channel 0 registered
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: OSD enabled
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:OSD.cpp]: OSD init begin
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:OSD.cpp]: IMP_OSD_CreateGroup group 0 created
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:OSD.cpp]: IMP_OSD_Start succeed
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:OSD.cpp]: OSD init completed
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: IMP_System_Bind(FS, OSD)
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: IMP_System_Bind(OSD, ENC)
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: Frame Source Channel 0 enabled
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:main.cpp]: JPEG support enabled
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: Encoder JPEG Channel 1 created
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: Encoder JPEG Channel 1 registered
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: Encoder Start
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.cpp]: Encoder StartRecvPic success
Jun 18 16:39:44 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.hpp]: Create Sink: 0
Jun 18 16:39:44 thingino-t21n daemon.info /etc/init.d/S96impconfig: Connecting to libimp-control OK
Jun 18 16:39:44 thingino-t21n daemon.info /etc/init.d/S96impconfig: Restoring IMP Configuration: Disabled
Jun 18 16:39:44 thingino-t21n daemon.info /etc/init.d/S96onvif: Starting ONVIF Disabled
Jun 18 16:39:44 thingino-t21n daemon.info : starting pid 1612, tty '/dev/console': '/sbin/getty -L console 0 vt100'
Jun 18 16:39:44 thingino-t21n daemon.info /etc/init.d/S96record: Starting openRTSP Disabled
Jun 18 16:39:46 thingino-t21n user.debug prudynt[1457]: [DEBUG:RTSP.cpp]: Got SPS (H264)
Jun 18 16:39:46 thingino-t21n user.debug prudynt[1457]: [DEBUG:RTSP.cpp]: Got PPS (H264)
Jun 18 16:39:46 thingino-t21n user.debug prudynt[1457]: [DEBUG:Encoder.hpp]: Destroy Sink: 0
Jun 18 16:39:46 thingino-t21n user.debug prudynt[1457]: [DEBUG:RTSP.cpp]: Got necessary NAL Units.
Jun 18 16:39:46 thingino-t21n user.info prudynt[1457]: [INFO:RTSP.cpp]: stream 0 available at: rtsp://127.0.1.1/ch0
Jun 18 16:40:00 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:01 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:02 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:03 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:04 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:05 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:06 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:07 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:08 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:09 thingino-t21n auth.info login[1612]: root login on 'console'
Jun 18 16:40:09 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:10 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:11 thingino-t21n user.info : password for 'root' changed
Jun 18 16:40:11 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:13 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:14 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
Jun 18 16:40:15 thingino-t21n daemon.info udhcpc[1224]: broadcasting discover
themactep commented 1 month ago
Jun 18 16:39:40 thingino-t21n daemon.info portal[1254]: Interface 'eth0' exists.

So the portal detected presence of eth0 and refused to start. But since there is no cable, there is no connection.

We need to check not only for the interface presence but also for it being active. And maybe utilize priority of ports if our little system smart enough to do that.

jayfan0 commented 1 month ago

A few things of notice that may provide some ideas:

  1. eth0 interface was still available even when disable_eth was set to true. Maybe this interface needs to be dropped on boot based on that env variable? This makes most sense imo since wlan0 is able to be dropped and added based on wlandev
  2. eth0 does not have an allocated ip address (At least via dhcp, didnt check static) when disabled, so maybe look for an ip?
  3. obviously there is no valid ethernet network so check if a ping to local host or gateway or something (taking in to account users who block internet access to cameras via vlan or firewalls)
  4. something else
gtxaspec commented 1 month ago

i believe you can use /sys/class/net/eth0/carrier to determine if the eth0 link is online

jayfan0 commented 1 month ago

i just checked grep "" /sys/class/net/eth0/* which includes the output from carrier. It works for detecting if the wire is physically plugged in (1) or not (0), but if i use disable_eth=true then i dont get an ip address but the output is exactly the same

jayfan0 commented 1 month ago

quick update:

This is just a test but I've added a check for the disable_eth variable which, if set to true, ended up showing the thingino AP, so we're half way there!

iface_exists() {                                                                 
        iface="$1"                                                               

        if [ -z "$iface" ]; then                            
                echo "Interface parameter missing." 2>&1 | log
                return 1                                    
        fi                                                          

        if ip link show $iface &> /dev/null; then                   
                if [ "eth0" == $iface ] && [ $(get disable_eth) == "true" ]; then
                        echo "eth0 env variable is disabled" | log
                        return 1
                fi                            

                echo "Interface '$iface' exists." 2>&1 | log
                return 0                          
        else                                      
                echo "Interface '$iface' does not exist." 2>&1 | log
                return 1
        fi              
} 

Now just need to stop the portal running if wlandev is defined/ wlan is enabled and ethernet is active

EDIT:

This works by pinging the default gateway: (found from here)

iface_exists() {
    iface="$1"

    if [ -z "$iface" ]; then
        echo "Interface parameter missing." 2>&1 | log
        return 1
    fi

    if ip link show $iface &> /dev/null; then

        if [ "eth0" == $iface ] && ping_gateway; then
            echo "eth0 has no local connection" | log
            return 1
        fi

        echo "Interface '$iface' exists." 2>&1 | log
        return 0
    else
        echo "Interface '$iface' does not exist." 2>&1 | log
        return 1
    fi
}

ping_gateway() {
    #  Ping default gateway, return 0 if successful, return 1 if fail
    echo "pinging gateway using $iface..." | log
    ping -q -w 1 -c 1 -I "$iface" `ip r | grep default | cut -d ' ' -f 3` > /dev/null && return 0 || return 1
}

still same issue with portal running even with active ethernet AND defined wlandev (therefore enabled wlan). Looking at the code, S41portal only brings up the AP if there isnt a connection.

May need to look at what does the actual routing between www and www-portal web pages?

themactep commented 4 weeks ago

fixed with #118