예제 #1
0
파일: xf86Calcomp.c 프로젝트: aosm/X11
/* 
 * The DeviceControl function should not need to be changed
 * except to remove ErrorFs
 */
static Bool
DeviceControl (DeviceIntPtr dev, int mode)
{
	Bool	RetValue;

/*	ErrorF ("DeviceControl called mode = %d\n", mode);*/
	switch (mode)
	{
	case DEVICE_INIT:
/*		ErrorF ("\tINIT\n");*/
		DeviceInit (dev);
		RetValue = Success;
		break;
	case DEVICE_ON:
/*		ErrorF ("\tON\n");*/
		RetValue = DeviceOn( dev );
		break;
	case DEVICE_OFF:
/*		ErrorF ("\tOFF\n");*/
		RetValue = DeviceOff( dev );
		break;
	case DEVICE_CLOSE:
/*		ErrorF ("\tCLOSE\n");*/
		RetValue = DeviceClose( dev );
		break;
	default:
		ErrorF ("\tBAD MODE\n");
		RetValue = BadValue;
	}

	return( RetValue );
}
예제 #2
0
void CALLBACK CDVDclose() {
#ifdef VERBOSE_FUNCTION
  PrintLog("CDVD interface: CDVDclose()");
#endif /* VERBOSE_FUNCTION */

  DeviceClose();
} // END CDVDclose()
예제 #3
0
파일: KPmacC.cpp 프로젝트: japgo/mygithub
bool	KPmacC::Close()
{
	if (m_bConnected == TRUE)
	{
		DeviceClose(m_nDevice);			// 해당 Device를 Close한다.
		m_bConnected = FALSE;
	}

	return true;
}
예제 #4
0
void MsdcNvtCb_LcdClose(void* pData)
{
    tMSDCEXT_LCD_CTRL* pCtrl = MsdcNvtCb_LcdGetCtrl();
    tMSDCEXT_LCD_DRV_CLOSE* pDesc = BEGIN_MSDC_NVT_CB(tMSDCEXT_LCD_DRV_CLOSE,pData);
    if(pDesc==NULL)
        return;

    pCtrl->pCmdQueueClose = pDesc->pCmdQueue;
    pCtrl->nCmdClose = pDesc->nCmd;
    DeviceClose();

    pDesc->tParent.bOK = TRUE;
}
예제 #5
0
파일: device.c 프로젝트: Codyle/pcsx2
// Called by PollLoop() and CDVDgetTrayStatus()
s32 DeviceTrayStatus()
{
	s32 s32result;
	errno = 0;
#ifdef VERBOSE_FUNCTION_DEVICE
	PrintLog("CDVD device: DeviceTrayStatus()");
#endif /* VERBOSE_FUNCTION_DEVICE */
	if (devicehandle == -1)
		return (-1); // ENDIF- Someone forget to open the device?
	if ((devicecapability & CDC_DRIVE_STATUS) != 0) {
		s32result = ioctl(devicehandle, CDROM_DRIVE_STATUS);
		if (s32result < 0) {
#ifdef VERBOSE_WARNINGS
			PrintLog("CDVD device:   Trouble reading Drive Status!");
			PrintLog("CDVD device:     Error: (%i) %i:%s", s32result, errno, strerror(errno));
#endif /* VERBOSE_WARNINGS */
			s32result = CDS_TRAY_OPEN;
		} // ENDIF- Failure to get status? Assume it's open.
		errno = 0;
	} else {
		s32result = ioctl(devicehandle, CDROM_DISC_STATUS);
		if (errno != 0) {
#ifdef VERBOSE_WARNINGS
			PrintLog("CDVD device:   Trouble detecting Disc Status presense!");
			PrintLog("CDVD device:     Error: (%i) %i:%s", s32result, errno, strerror(errno));
#endif /* VERBOSE_WARNINGS */
			s32result = CDS_TRAY_OPEN;
			errno = 0;
		} // ENDIF- Trouble?
		if (s32result == CDS_NO_DISC)
			s32result = CDS_TRAY_OPEN; // ENDIF- Is there no disc in the device? Guess the tray is open
	} // ENDIF- Can we poll the tray directly? (Or look at disc status instead?)
	if (s32result == CDS_TRAY_OPEN) {
		traystatus = CDVD_TRAY_OPEN;
		if (disctype != CDVD_TYPE_NODISC) {
			DeviceClose(); // Kind of severe way of flushing all buffers.
			DeviceOpen();
			InitDisc();
		} // ENDIF- Tray just opened... clear disc info
	} else {
		traystatus = CDVD_TRAY_CLOSE;
		if (disctype == CDVD_TYPE_NODISC)
			DeviceGetDiskType(); // ENDIF- Tray just closed? Get disc information
	} // ENDIF- Do we detect an open tray?
	return (traystatus);
} // END CDVD_getTrayStatus()
예제 #6
0
파일: mainbox.c 프로젝트: mfitz21/pcsx2-rr
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) {

  const char *tempdevice;

  int retval;



  MainBoxUnfocus();



  tempdevice = gtk_entry_get_text(GTK_ENTRY(mainbox.device));

  strcpy(conf.devicename, tempdevice); // Temporarily put in new device name

  tempdevice = NULL;

  if(*(conf.devicename) != 0) {

    retval = DeviceOpen(); // Test by opening the device.

    DeviceClose(); // Failed or not, close it.

    if(retval != 0) {

      MainBoxRefocus();

      return(TRUE);

    } // ENDIF- Not an ISO file? Message and Stop here.

  } // ENDIF- Is there an ISO file to check out?



  SaveConf();



  MainBoxCancelEvent(widget, event, data);

  return(TRUE);

} // END MainBoxOKEvent()
예제 #7
0
파일: mainbox.c 프로젝트: Codyle/pcsx2
void MainBoxOKEvent()
{
	int retval;
	MainBoxUnfocus();
	GetDlgItemText(mainboxwindow, IDC_0202, conf.devicename, 256);
	retval = DeviceOpen();
	DeviceClose();
	if (retval != 0) {
		MainBoxRefocus();
		MessageBox(mainboxwindow,
		           "Could not open the device",
		           "CDVDlinuz Message",
		           MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
		return;
	} // ENDIF- Trouble opening device? Abort here.
	SaveConf();
	MainBoxCancelEvent();
	return;
} // END MainBoxOKEvent()
예제 #8
0
s32 CALLBACK CDVDtest() {
  s32 s32result;

  errno = 0;

  if(devicehandle != -1) {
#ifdef VERBOSE_WARNINGS
    PrintLog("CDVD interface:   Device already open");
#endif /* VERBOSE_WARNINGS */
    return(0);
  } // ENDIF- Is the CD/DVD already in use? That's fine.

#ifdef VERBOSE_FUNCTION
  PrintLog("CDVD driver: CDVDtest()");
#endif /* VERBOSE_FUNCTION */

  s32result = DeviceOpen();
  DeviceClose();
  return(s32result);
} // END CDVDtest()
예제 #9
0
파일: device.c 프로젝트: Blackbird88/pcsx2
s32 DeviceTrayStatus() {

    BOOL boolresult;



    if(devicehandle == NULL)  return(-1);

    if(devicehandle == INVALID_HANDLE_VALUE)  return(-1);



#ifdef VERBOSE_FUNCTION_DEVICE

    PrintLog("CDVDlinuz device: DeviceTrayStatus()");

#endif /* VERBOSE_FUNCTION_DEVICE */



    switch(traystatusmethod) {

    case 1:

        boolresult = DeviceTrayStatusStorage();

        break;

    case 2:

        boolresult = DeviceTrayStatusCDRom();

        break;

    case 3:

        boolresult = DeviceTrayStatusDisk();

        break;

    default:

        boolresult = FALSE;

        break;

    } // ENDSWITCH traystatusmethod- One method already working? Try it again.



    if(boolresult == FALSE) {

        traystatusmethod = 0;

        boolresult = DeviceTrayStatusStorage();

        if(boolresult == TRUE) {

            traystatusmethod = 1;

        } else {

            boolresult = DeviceTrayStatusCDRom();

            if(boolresult == TRUE) {

                traystatusmethod = 2;

            } else {

                boolresult = DeviceTrayStatusDisk();

                if(boolresult == TRUE)  traystatusmethod = 3;

            } // ENDIF- Did we succeed with CDRom?

        } // ENDIF- Did we succeed with Storage?

    } // Single call to already working test just failed? Test them all.



    if(boolresult == FALSE) {

        if(traystatus == CDVD_TRAY_CLOSE) {

#ifdef VERBOSE_FUNCTION_DEVICE

            PrintLog("CDVDlinuz device:   Tray just opened!");

#endif /* VERBOSE_FUNCTION_DEVICE */

            traystatus = CDVD_TRAY_OPEN;

            DeviceClose();

            DeviceOpen();

            InitDisc();

        } // ENDIF- Just opened? clear disc info

        return(traystatus);

    } // ENDIF- Still failed? Assume no disc in drive then.



    if(traystatus == CDVD_TRAY_OPEN) {

        traystatus = CDVD_TRAY_CLOSE;

#ifdef VERBOSE_FUNCTION_DEVICE

        PrintLog("CDVDlinuz device:   Tray just closed!");

#endif /* VERBOSE_FUNCTION_DEVICE */

        DeviceGetDiskType();

        return(traystatus);

    } // ENDIF- Just closed? Get disc information



    return(traystatus);

} // END DeviceTrayStatus()
예제 #10
0
/**
  Close LCD driver, public function for global use

  Release LCD driver

*/
void ClosePanel(void)
{
    DeviceClose();
}
예제 #11
0
파일: devicebox.c 프로젝트: Codyle/pcsx2
gint DeviceBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
{
	char templine[256];
	u8 tempbuffer[2352];
	struct IsoFile *tofile;
	const char *tempdevice;
	s32 retval;
	cdvdTD cdvdtd;
	int stop;
	int compressmethod;
	int multi;
	int imagetype;
	int i;
	DeviceBoxUnfocus();
	tempdevice = gtk_entry_get_text(GTK_ENTRY(devicebox.device));
	strcpy(conf.devicename, tempdevice); // Temporarily put in new device name
	tempdevice = NULL;
	retval = DeviceOpen();
	if (retval != 0) {
		DeviceClose();
		MessageBoxShow("Could not open the device", 2);
		return (TRUE);
	} // ENDIF- Trouble opening device? Abort here.
	DeviceTrayStatus();
	retval = DiscInserted();
	if (retval != 0) {
		DeviceClose();
		MessageBoxShow("No disc in the device\r\nPlease put a disc in and try again.", 2);
		return (TRUE);
	} // ENDIF- Trouble opening device? Abort here.
	retval = DeviceGetTD(0, &cdvdtd); // Fish for Ending Sector
	if (retval < 0) {
		DeviceClose();
		MessageBoxShow("Could not retrieve disc sector size", 2);
		return (TRUE);
	} // ENDIF- Trouble getting disc sector count?
	compressmethod = gtk_combo_box_get_active(GTK_COMBO_BOX(devicebox.compress));
	if (compressmethod > 0)  compressmethod += 2;
	multi = 0;
	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(devicebox.multi)) == TRUE)
		multi = 1;
	imagetype = 0;
	if ((disctype != CDVD_TYPE_PS2DVD) &&
	    (disctype != CDVD_TYPE_DVDV))  imagetype = 8;
	tofile = IsoFileOpenForWrite(gtk_entry_get_text(GTK_ENTRY(devicebox.file)),
	                             imagetype,
	                             multi,
	                             compressmethod);
	if (tofile == NULL) {
		DeviceClose();
		MessageBoxShow("Could not create the new ISO file", 2);
		return (TRUE);
	} // ENDIF- Trouble opening the ISO file?
	// Open Progress Bar
	sprintf(templine, "%s -> %s",
	        gtk_entry_get_text(GTK_ENTRY(devicebox.device)), tofile->name);
	ProgressBoxStart(templine, (off64_t) cdvdtd.lsn);
	tofile->cdvdtype = disctype;
	for (i = 0; i < 2048; i++)  tofile->toc[i] = tocbuffer[i];
	stop = 0;
	mainbox.stop = 0;
	progressbox.stop = 0;
	while ((stop == 0) && (tofile->sectorpos < cdvdtd.lsn)) {
		if (imagetype == 0) {
			retval = DeviceReadTrack((u32) tofile->sectorpos,
			                         CDVD_MODE_2048,
			                         tempbuffer);
		} else {
			retval = DeviceReadTrack((u32) tofile->sectorpos,
			                         CDVD_MODE_2352,
			                         tempbuffer);
		} // ENDIF- Are we reading a DVD sector? (Or a CD sector?)
		if (retval < 0) {
			for (i = 0; i < 2352; i++)
				tempbuffer[i] = 0; // NEXT i- Zeroing the buffer
		} // ENDIF- Trouble reading next block?
		retval = IsoFileWrite(tofile, tempbuffer);
		if (retval < 0) {
			MessageBoxShow("Trouble writing new file", 3);
			stop = 1;
		} // ENDIF- Trouble writing out the next block?
		ProgressBoxTick(tofile->sectorpos);
		while (gtk_events_pending())  gtk_main_iteration();
		if (mainbox.stop != 0)  stop = 2;
		if (progressbox.stop != 0)  stop = 2;
	} // ENDWHILE- No reason found to stop...
	ProgressBoxStop();
	if (stop == 0) {
		if (tofile->multi == 1)  tofile->name[tofile->multipos] = '0'; // First file
		strcpy(templine, tofile->name);
	} // ENDIF- Did we succeed with the transfer?
	DeviceClose();
	if (stop == 0) {
		IsoSaveTOC(tofile);
		tofile = IsoFileClose(tofile);
		gtk_entry_set_text(GTK_ENTRY(mainbox.file), templine);
	} else
		tofile = IsoFileCloseAndDelete(tofile); // ENDIF- (Failed to complete writing file? Get rid of the garbage files.)
	if (stop != 1)  DeviceBoxRefocus();
	if (stop == 0)  DeviceBoxCancelEvent(widget, event, data);
	return (TRUE);
} // END DeviceBoxOKEvent()
예제 #12
0
void DeviceBoxOKEvent() {

  char templine[256];

  u8 tempbuffer[2352];

  struct IsoFile *tofile;

  s32 retval;

  cdvdTD cdvdtd;

  int stop;

  HWND tempitem;

  int compressmethod;

  int multi;

  int imagetype;

  int i;



  DeviceBoxUnfocus();



  GetDlgItemText(deviceboxwindow, IDC_0302, conf.devicename, 256);

  retval = DeviceOpen();

  if(retval != 0) {

    DeviceClose();

    DeviceBoxRefocus();

    MessageBox(deviceboxwindow,

               "Could not open the device",

               "CDVDisoEFP Message",

               MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);

    return;

  } // ENDIF- Trouble opening device? Abort here.



  DeviceTrayStatus();

  retval = DiscInserted();

  if(retval != 0) {

    DeviceClose();

    DeviceBoxRefocus();

    MessageBox(deviceboxwindow,

               "No disc in the device\r\nPlease put a disc in and try again.",

               "CDVDisoEFP Message",

               MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);

    return;

  } // ENDIF- Trouble opening device? Abort here.



  retval = DeviceGetTD(0, &cdvdtd); // Fish for Ending Sector

  if(retval < 0) {

    DeviceClose();

    DeviceBoxRefocus();

    MessageBox(deviceboxwindow,

               "Could not retrieve disc sector size",

               "CDVDisoEFP Message",

               MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);

    return;

  } // ENDIF- Trouble getting disc sector count?



  tempitem = GetDlgItem(deviceboxwindow, IDC_0309);

  compressmethod = ComboBox_GetCurSel(tempitem);

  tempitem = NULL;

  if(compressmethod > 0)  compressmethod += 2;



  multi = 0;

  if(IsDlgButtonChecked(deviceboxwindow, IDC_0311))  multi = 1;



  imagetype = 0;

  if((disctype != CDVD_TYPE_PS2DVD) &&

     (disctype != CDVD_TYPE_DVDV))  imagetype = 8;



  GetDlgItemText(deviceboxwindow, IDC_0305, templine, 256);

  tofile = IsoFileOpenForWrite(templine,

                               imagetype,

                               multi,

                               compressmethod);

  if(tofile == NULL) {

    DeviceClose();

    DeviceBoxRefocus();

    MessageBox(deviceboxwindow,

               "Could not create the new ISO file",

               "CDVDisoEFP Message",

               MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);

    return;

  } // ENDIF- Trouble opening the ISO file?



  // Open Progress Bar

  sprintf(templine, "%s -> %s", conf.devicename, tofile->name);

  ProgressBoxStart(templine, (off64_t) cdvdtd.lsn);



  tofile->cdvdtype = disctype;

  for(i = 0; i < 2048; i++)  tofile->toc[i] = tocbuffer[i];



  stop = 0;

  mainboxstop = 0;

  progressboxstop = 0;

  while((stop == 0) && (tofile->sectorpos < cdvdtd.lsn)) {

    if(imagetype == 0) {

      retval = DeviceReadTrack((u32) tofile->sectorpos,

                               CDVD_MODE_2048,

                               tempbuffer);

    } else {

      retval = DeviceReadTrack((u32) tofile->sectorpos,

                               CDVD_MODE_2352,

                               tempbuffer);

    } // ENDIF- Are we reading a DVD sector? (Or a CD sector?)

    if(retval < 0) {

      for(i = 0; i < 2352; i++) {

        tempbuffer[i] = 0;

      } // NEXT i- Zeroing the buffer

    } // ENDIF- Trouble reading next block?

    retval = IsoFileWrite(tofile, tempbuffer);

    if(retval < 0) {

      MessageBox(deviceboxwindow,

                 "Trouble writing new file",

                 "CDVDisoEFP Message",

                 MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);

      stop = 1;

    } // ENDIF- Trouble writing out the next block?



    ProgressBoxTick(tofile->sectorpos);



    if(mainboxstop != 0)  stop = 2;

    if(progressboxstop != 0)  stop = 2;

  } // ENDWHILE- No reason found to stop...



  ProgressBoxStop();



  if(stop == 0) {

    if(tofile->multi == 1)  tofile->name[tofile->multipos] = '0'; // First file

    strcpy(templine, tofile->name);

  } // ENDIF- Did we succeed with the transfer?



  DeviceClose();

  if(stop == 0) {

    IsoSaveTOC(tofile);

    tofile = IsoFileClose(tofile);

    SetDlgItemText(mainboxwindow, IDC_0202, templine);

  } else {

    tofile = IsoFileCloseAndDelete(tofile);

  } // ENDIF- (Failed to complete writing file? Get rid of the garbage files.)



  DeviceBoxRefocus();

  if(stop == 0)  DeviceBoxCancelEvent();

  return;

} // END DeviceBoxOKEvent()