修改N9 CAT1固件,打开自动休眠,tcp sleep时间修改为1500ms
authorpenglei <1624952103@qq.com>
Thu, 16 Oct 2025 11:10:13 +0000 (19:10 +0800)
committerpenglei <1624952103@qq.com>
Thu, 16 Oct 2025 11:10:13 +0000 (19:10 +0800)
cat1modem/src/N9/cat1Service.py
cat1modem/src/tcpserver.py
code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c

index a69f716..c9d4c11 100644 (file)
@@ -94,7 +94,7 @@ CURRENT_APP_TYPE="pysrv"
 voiceCall.setVolume(10)
 clog.info("voice call volume {}".format(voiceCall.getVolume()))
 lpm_fd = pm.create_wakelock("system_lock", len("system_lock"))
-# pm.autosleep(1)
+pm.autosleep(1)
 pm.wakelock_lock(lpm_fd)
 clog.info("create_wakelock {}".format(pm.get_wakelock_num()))
 telecomTimerCount = 0
index afe23b2..a82d87c 100644 (file)
@@ -153,7 +153,7 @@ class TcpServiceInit:
                 self.conn=cli_conn
                 clog.info('[serveice] accept a client: %s, %s' % (cli_ip_addr, cli_port))
             except :
-                utime.sleep_ms(20)
+                utime.sleep_ms(1500)
     
     def cat1FileTimerCb(self,*argc):
         clog.info("timer test\r\n")
index 968a6c6..b052e01 100644 (file)
@@ -346,10 +346,10 @@ static int32_t SetAefProfile(SubPortOutContext *portOutCtx, const enum AudioCate
     if (ret != MEDIA_HAL_OK) {
         MEDIA_HAL_LOGE(MODULE_NAME, "uapi_snd_set_aef_profile(%d) failed: 0x%x", profile, ret);
     }
-    ret = uapi_snd_set_port_aef_enable(portOutCtx->sndHandle, BUILTIN_SND_OUT_PORT,\r
-        SND_PORT_AEF_TYPE, SND_PORT_AEF_ENABLE);\r
-    if (ret != MEDIA_HAL_OK) {\r
-        MEDIA_HAL_LOGE(MODULE_NAME, "uapi_snd_set_port_aef_enable(%d) failed: 0x%x", SND_PORT_AEF_TYPE, ret);\r
+    ret = uapi_snd_set_port_aef_enable(portOutCtx->sndHandle, BUILTIN_SND_OUT_PORT,
+        SND_PORT_AEF_TYPE, SND_PORT_AEF_ENABLE);
+    if (ret != MEDIA_HAL_OK) {
+        MEDIA_HAL_LOGE(MODULE_NAME, "uapi_snd_set_port_aef_enable(%d) failed: 0x%x", SND_PORT_AEF_TYPE, ret);
     }
     return MEDIA_HAL_OK;
 }
@@ -377,16 +377,22 @@ static int32_t AODevOpen(SubPortOutContext *portOutCtx, const enum AudioCategory
             MediaHalMutexUnLock(g_subPortTrackOutLock);
             return ret;
         }
-        if (audioCategory == AUDIO_IN_COMMUNICATION) {\r
-            ret = uapi_snd_set_track_mode(portOutCtx->sndHandle, sndAttr.port_attr[0].out_port, SND_TRACK_MODE_BT_SCO);\r
+#ifdef BOARD_LEINIAO
+        uapi_snd_gain gain;
+        gain.integer = -6;
+        gain.decimal = 0;
+        uapi_snd_set_volume(portOutCtx->sndHandle, sndAttr.port_attr[0].out_port, &gain, TD_NULL);
+#endif
+        if (audioCategory == AUDIO_IN_COMMUNICATION) {
+            ret = uapi_snd_set_track_mode(portOutCtx->sndHandle, sndAttr.port_attr[0].out_port, SND_TRACK_MODE_BT_SCO);
         } else if (audioCategory == AUDIO_IN_MEDIA) {
             ret = uapi_snd_set_track_mode(portOutCtx->sndHandle,
                 sndAttr.port_attr[0].out_port, SND_TRACK_MODE_LOCAL_MUSIC);
         }
-        if (ret != MEDIA_HAL_OK) {\r
-            MEDIA_HAL_LOGE(MODULE_NAME, "set track mode failed, ret = %d", ret);\r
-            MediaHalMutexUnLock(g_subPortTrackOutLock);\r
-            return MEDIA_HAL_INVALID_PARAM;\r
+        if (ret != MEDIA_HAL_OK) {
+            MEDIA_HAL_LOGE(MODULE_NAME, "set track mode failed, ret = %d", ret);
+            MediaHalMutexUnLock(g_subPortTrackOutLock);
+            return MEDIA_HAL_INVALID_PARAM;
         }
         ret = SetAefProfile(portOutCtx, audioCategory);
         if (ret != MEDIA_HAL_OK) {