#include "mm_camcorder_rm.h"
#include "mm_camcorder_internal.h"
+#define PROCESS_NAME_PATH_MAX 200
+
static rm_cb_result __mmcamcorder_rm_callback(int handle, rm_callback_type event_src,
rm_device_request_s *info, void* cb_data)
{
return cb_res;
}
+void _mmcamcorder_get_appid_bypid(int pid, char *name, size_t size)
+{
+ FILE *cmdline;
+ char buf[PROCESS_NAME_PATH_MAX];
+ int length;
+ unsigned int buf_pos = 0;
+ unsigned int ret_pos = 0;
+ char *read = NULL;
+
+
+ mmf_return_if_fail(name);
+
+ if (size > 0u) {
+ name[0] = 0;
+ }
+
+ length = snprintf(buf, sizeof(buf), "/proc/%d/cmdline", (int)pid);
+ if (length >= (int)sizeof(buf))
+ return;
+
+ cmdline = fopen(buf, "r");
+ if (NULL == cmdline) {
+ MMCAM_LOG_ERROR("File[%s] open failed", buf);
+ return;
+ }
+
+ read = fgets(buf, sizeof(buf), cmdline);
+ fclose(cmdline);
+
+ if (NULL == read) {
+ MMCAM_LOG_ERROR("File read failed");
+ return;
+ }
+
+ for (buf_pos = 0; buf_pos < sizeof(buf); buf_pos++) {
+ switch(buf[buf_pos]) {
+ case '\0':
+ name[ret_pos] = '\0';
+ return;
+ case '/':
+ ret_pos = 0;
+ break;
+ default:
+ if (ret_pos < size)
+ name[ret_pos] = buf[buf_pos];
+
+ ret_pos++;
+ break;
+ }
+ }
+
+}
+
+
int _mmcamcorder_rm_create(MMHandleType handle)
{
int ret = RM_OK;
mm_camcorder_get_attributes(handle, NULL,
MMCAM_CLIENT_PID, &hcamcorder->rci.app_pid,
NULL);
- aul_app_get_appid_bypid(hcamcorder->rci.app_pid, hcamcorder->rci.app_id, sizeof(hcamcorder->rci.app_id));
+ _mmcamcorder_get_appid_bypid(hcamcorder->rci.app_pid, hcamcorder->rci.app_id, sizeof(hcamcorder->rci.app_id));
/* RM register */
/* NULL should be passed for the rci parameter if the application does not have "visibility" */