- int err = 0;
- int fd = -1;
- int size = 0;
- ipc_t data = {{0,},{0,},{0,}};
-
- debug_msg("[BOOT] play boot sound [%s]!!!!", path);
- if (path == NULL)
- return MM_ERROR_SOUND_INVALID_FILE;
-
- /* Check whether file exists */
- fd = open(path, O_RDONLY);
- if (fd == -1) {
- debug_error("file open failed with [%s][%d]\n", strerror(errno), errno);
- switch (errno) {
- case ENOENT:
- return MM_ERROR_SOUND_FILE_NOT_FOUND;
- default:
- return MM_ERROR_SOUND_INTERNAL;
- }
- }
- close(fd);
- fd = -1;
-
- /* Open PIPE */
- fd = open(KEYTONE_PATH, O_WRONLY | O_NONBLOCK);
- if (fd == -1) {
- debug_error("Fail to open pipe\n");
- return MM_ERROR_SOUND_FILE_NOT_FOUND;
- }
-
- MMSOUND_STRNCPY(data.filename, path, FILE_FULL_PATH);
- MMSOUND_STRNCPY(data.role, "system", ROLE_NAME_LEN);
- MMSOUND_STRNCPY(data.volume_gain_type, "booting", VOLUME_GAIN_TYPE_LEN);
-
- debug_msg("filepath=[%s], role=[%s], volume_gain_type=[%s]\n", data.filename, data.role, data.volume_gain_type);
- size = sizeof(ipc_t);
-
- /* Write to PIPE */
- err = write(fd, &data, size);
- if (err < 0) {
- debug_error("Fail to write data: [%s][%d]\n", strerror(errno), errno);
- close(fd);
- return MM_ERROR_SOUND_INTERNAL;
- }
- /* Close PIPE */
- close(fd);
-