Forum Topic - No State Change event after Play back stooped and device removed:
   
No State Change event after Play back stooped and device removed  
Hello,

I Had inserted USB and got State Change event .Started playing media and after some time stopped the play back.Then 
removed USB but i didnot get state change event only got Play back state stopped.

Is this the correct behaviour.In this case how to know that device is removed ?

Thanks,
Vijaya Santhi.
Re: No State Change event after Play back stooped and device removed  
Normally I would expect a state change event saying the device is ejected.
MME relies on MCD, you could do "cat /dev/mcd/EJECTED" to see if the
device is reported as ejected.

Regards,
Gilles


Re: No State Change event after Play back stooped and device removed  
Thank You Gilles

Yes MCD is showing the usb entry when i executed cat /dev/mcd/EJECTED
But iam not getting the state change event.
iam receiving only  Play Stopped event when i stopped playback.

What i observed is if again insert the usb iam getting two state change events , one for ejection and another for 
insertion
Are there any synchronisation issues?
This is only happening with if i remove usb after stopping the playback.

If i remove the device in paused or playing state ,mme is giving proper state change events

 
Re: No State Change event after Play back stooped and device removed  
What is the output of "use -i mme-generic"?

Thanks
Gilles

Re: No State Change event after Play back stooped and device removed  
Here is the output

# use -i mme-generic
NAME=mme-generic
DESCRIPTION=MME Generic build
DATE=2012/04/02-18:55:00-EDT
STATE=stable
HOST=ccbuild
USER=builder
VERSION=20.26.16.1
TAGID=4503@645078

Thanks,
Santhi
Re: No State Change event after Play back stooped and device removed  
I would need you to do the following:

mmecli set_debug 4 0

Then reproduce the problem and sent me the output of sloginfo.

Regards,
Gilles

Re: No State Change event after Play back stooped and device removed  
Hello Gilles,
please find the log attached.

Thanks,
Santhi
Attachment: Text sloginfo_deviceremoval.txt 18.92 KB
Re: No State Change event after Play back stooped and device removed  
Hi Santhi,

In your logs I see the ejection, immediate when the system level logs
report an ejection the MME does send the event immediately
(MME_EVENT_MS_STATECHANGE):

Jan 01 00:04:32    2    12     0 CLASS_ExtractDevice:  dno 1, vid 18a5,
parent 0, port 0, openings 1
Jan 01 00:04:32    2    12     0 CLASS_ExtractDevice: holdoff port 0
Jan 01 00:04:32    2    19   900 umass_removal: path 1, devno 1, vid 18a5,
did 240, class 8, sclass 6, proto 50, tflags 3000
Jan 01 00:04:32    2    12     0 udi_detach:  defered removal, dno 1
Jan 01 00:04:32    2    12     0 CLASS_ExtractDeviceCleanup:  dno 1
Jan 01 00:04:32    5    27     0 MME:handle_eject(472): Device "/fs/usb0"
ejected.
Jan 01 00:04:32    5    27     0 MME:ms_ejected(2549): Media store at
"/fs/usb0" with ID 1 is being ejected.
Jan 01 00:04:32    5    27     0 MME:ms_state_change_internal(2313): Media
store 1 state change: active->unavailable; location ""->"".
Jan 01 00:04:32    5    27     0 MME:handle_eject(463): No more data on
"/dev/mcd/EJECTED".
Jan 01 00:04:32    5    27     0 MME:mediastores_entry_update(622): Set
database state to unavailable for media store with ID 1.
Jan 01 00:04:32    5    27     0 MME:slots_table_set_inactive(479): Set
slot inactive for media store with ID 1.
Jan 01 00:04:32    5    27     0 MME:ntfy_log_event(859):
MME_EVENT_MS_STATECHANGE(Media store 1; active->unavailable; device type
1, storage type 2)





On 13-08-19 5:41 AM, "kandregula vijaya santhi"
<community-noreply@qnx.com> wrote:

Hello Gilles,
please find the log attached.

Thanks,
Santhi



_______________________________________________

Development
http://community.qnx.com/sf/go/post104270
To cancel your subscription to this discussion, please e-mail
development-multimedia-unsubscribe@community.qnx.com

Re: No State Change event after Play back stooped and device removed  
Thank You Gilles

But iam not getting the stae change event instead iam getting event number 35 (MME_EVENT_TRKSESSION).

is any problem in handling events in my code.
Please find the code snippet below


void* ReadEvents()
{
	struct _pulse pulseR;
	int coid=0,chid=0,cancelstate=0;
	mme_playstate_t eMMEState;

	printf("Read Events\n");
	// Create channel to receive the pulse notification
	chid = ChannelCreate(0);

	// Connect to channel for the pulse notification
	coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0);
	SIGEV_PULSE_INIT(&event, coid, SIGEV_PULSE_PRIO_INHERIT, MME_EVENT_PULSE_CODE, 0);

	if ( -1 == mme_set_notification_interval(m_hMME,1000))
	{
		printf("warning:mme_set_notification_interval\n");
	}
	//Register for MME Events
	if (-1 == mme_register_for_events(m_hMME, MME_EVENT_CLASS_ALL, &event))
	{
		printf("Warning:Registering for Events Failed.\n");
		pthread_exit(NULL);
	}
	//wait for Events

    do
    {
        if (0 != MsgReceivePulse( chid, &pulseR, sizeof(pulseR), NULL))
        {
            continue;
        }

        if (-1 == mme_get_event(m_hMME, &mme_event))
        {
        	printf("Failed to get a media event.mme_get_event() set errno=%d\n", errno);
		   	//pthread_exit(NULL);
		}
		else
		{
		    // Don't allow the thread cleanup handler to be called while it is processing
		    // an MME event.  It may be sending a message and the mutex protecting the
		   	// worker framework handle may not get unlocked before the thread terminates.
		    if (EINVAL == pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cancelstate))
		   {
            	printf("Could not disable thread cancel state.Invalid state value.");
		   }
		    //printf("Event Received:%lu\n",mme_event->type);
           switch (mme_event->type)
		   {
		         case MME_EVENT_TIME:
		         {
		        	 mme_time_t *SData =(mme_time_t *)(mme_event->data);
		        	 uint64_t time=SData->time;
		        	 uint64_t duration=SData->duration;
		        	 MMESendTimeInfo(time,duration);
		         }
		         	 break;
		   	     case MME_EVENT_TRACKCHANGE:
		   	    	printf("MME_EVENT_TRACKCHANGE\n");

		   	    	break;
		         case MME_EVENT_PLAYSTATE:
		        	 printf("MME_EVENT_PLAYSTATE\n");
		   	         eMMEState = (mme_playstate_t)mme_event->data[0];
		   	         switch(eMMEState)
		   	                    {
		   	                    case MME_PLAYSTATE_UNKNOWN:
		   	                    	printf("MME_PLAYSTATE_UNKNOWN\n");

		   	                        break;
		   	                    case MME_PLAYSTATE_ERROR:
		   	                    	printf("MME_PLAYSTATE_ERROR\n");
		   	                        break;
		   	                    case MME_PLAYSTATE_PLAYING:
		   	                    	printf("MME_PLAYSTATE_PLAYING\n");
		   	                        break;
		   	                    case MME_PLAYSTATE_PAUSED:
		   	                    	printf("MME_PLAYSTATE_UNKNOWN\n");
		   	                        break;
		   	                    case MME_PLAYSTATE_STOPPED:
		   	                    	printf("MME_PLAYSTATE_STOPPED\n");
		   	                        break;
		   						case MME_PLAYSTATE_FASTFWD:
		   							printf("MME_PLAYSTATE_FASTFWD\n");
		   	                        break;
		   						case MME_PLAYSTATE_FASTREV:
		   							printf("MME_PLAYSTATE_FASTREV\n");
		   	                        break;
		   	                    default:
		   	                    	printf("Default MME_PLAYSTATE\n");
		   	                        break;
		   	                    }//End of Play event Switch


		   	                    break;

		   	                case MME_EVENT_FINISHED: {
		   	                	printf("MME_EVENT_FINISHED\n");
		   	                    break;
		   	                }
		   	                case MME_EVENT_PLAY_ERROR:
		   	                case MME_EVENT_FINISHED_WITH_ERROR:
		   	          ...
View Full Message
Re: No State Change event after Play back stooped and device removed  
Maybe you aren't caught up with all of the events, I.e. 2 events were
queued and you only called event_get() once?

Re: No State Change event after Play back stooped and device removed  
Thank You Gilles.
Iam waiting in while loop to receive the events.Iam not getting why iam not receving the state change event.But if i 
insert again iam getting the 2 state change events.
Is any settings iam missing?
Re: No State Change event after Play back stooped and device removed  
Try with mmdcli -e running in a terminal. Does mmdcli receive the proper
events? If so, you should compare your source code to the mmecli sample
source.

Thanks
Gilles

Re: No State Change event after Play back stooped and device removed  
Thank You Gilles.
mmecli is receiving the correct events i will check my code