예제 #1
0
/*
 * Do a hardware reset on the card, and set up necessary registers.
 *
 * This should be called as little as possible, because it disrupts the
 * token on the network (causes a RECON) and requires a significant delay.
 *
 * However, it does make sure the card is in a defined state.
 */
static int com90io_reset(struct net_device *dev, int really_reset)
{
	struct arcnet_local *lp = netdev_priv(dev);
	short ioaddr = dev->base_addr;

	BUGMSG(D_INIT, "Resetting %s (status=%02Xh)\n", dev->name, ASTATUS());

	if (really_reset) {
		/* reset the card */
		inb(_RESET);
		mdelay(RESETtime);
	}
	/* Set the thing to IO-mapped, 8-bit  mode */
	lp->config = (0x1C | IOMAPflag) & ~ENABLE16flag;
	SETCONF();

	ACOMMAND(CFLAGScmd | RESETclear);	/* clear flags & end reset */
	ACOMMAND(CFLAGScmd | CONFIGclear);

	/* verify that the ARCnet signature byte is present */
	if (get_buffer_byte(dev, 0) != TESTvalue) {
		BUGMSG(D_NORMAL, "reset failed: TESTvalue not present.\n");
		return 1;
	}
	/* enable extended (512-byte) packets */
	ACOMMAND(CONFIGcmd | EXTconf);

	/* done!  return success. */
	return 0;
}
void GPageLoadRequestManager::InitializeMainView()
{
	LOG_LEVEL4("InitializeMainView()");

	int iWidth (0);
	int iHeight(0);

	m_pMainView = new QWebView();

	if( GETCONF_BOOL(eDisplayManagerAutoAdjustmentViewSize) )
	{
		QScreen * pScreen(QScreen::instance());

		iHeight = pScreen->deviceHeight();
		iWidth  = pScreen->deviceWidth();

		QString strTemp("Window Size detected : [");
		strTemp += QString::number(iWidth)  + "x";
		strTemp += QString::number(iHeight) + "]";

		LOG_LEVEL3(strTemp);

		SETCONF(eDisplayManagerViewHeight, QString::number(iHeight));
		SETCONF(eDisplayManagerViewWidth, QString::number(iWidth));
	}
	else
	{
		iHeight = GETCONF_NUM(eDisplayManagerViewHeight);
		iWidth  = GETCONF_NUM(eDisplayManagerViewWidth);
	}

	m_pMainView->window()->resize(iWidth, iHeight);
	m_pMainView->window()->setFixedSize(iWidth, iHeight);
	m_pMainView->window()->showFullScreen();
	SetMainViewWidth(m_pMainView->width());
	SetMainViewHeight(m_pMainView->height());

	if( (m_pMainView->width() != iWidth) && (m_pMainView->height() != iHeight) )
	{
		throw GException("One of the dimensions exceded the maximun of the screen.");
	}

	LOG_LEVEL3(QString("Width(")  + QString::number(m_pMainView->width()) + ")");
	LOG_LEVEL3(QString("Height(") + QString::number(m_pMainView->height()) + ")");
}
void GSetPersonalityMsgCommand::Execute() throw(GException)
{
	LOG_LEVEL4("Execute()");
	
	std::auto_ptr<GResponseMsgData> poResponse(CreateInitializedResponse(GSetPersonalityMsgDataXML::CXMLTag, GMsgCmdDataFactory::CInterfaceVersion));
	
	try
	{
		GSetPersonalityMsgData *pRequestData(static_cast<GSetPersonalityMsgData *>(m_pData));
		if( pRequestData == NULL )
		{
			throw GEXCEPTION("Null pointer for GSetPersonalityMsgData *pRequestData");
		}
		pRequestData->Validate();

		QString strPersonality("");
		static QString const qsDefaultPersonality("default");

		if( pRequestData->GetPersonality() == qsDefaultPersonality )
		{
			strPersonality = GETCONF_STR_FROM_FILESYSTEM(eDisplayManagerPersonalityName);
		}
		else if( GPersonality::IsAValidPersonality(pRequestData->GetPersonality()) )
		{
			strPersonality = pRequestData->GetPersonality();
		}

		if( (!strPersonality.isEmpty()) && (SETCONF(eDisplayManagerPersonalityName, strPersonality)) )
		{
			poResponse->SetResponseCode(GResponseMsgData::eOk);

			QSharedPointer<GPersonalityView> pGPersonalityView = GPersonalityView::GetInstance();

			pGPersonalityView->RefreshPersonality();
		}
		else
		{
			poResponse->SetResponseCode(GResponseMsgData::eInvalidPersonality);
		}
	}
	catch( GException& e )
	{
		LOG_LEVEL1(QString("Excepcion: ")+e.GetMessage());

		poResponse->SetResponseCode(GResponseMsgData::eInvalidPersonality);
	}

	SetResponseNamespace(poResponse);
	m_pResponse=poResponse.release();
}
예제 #4
0
/* Set up the struct net_device associated with this card.  Called after
 * probing succeeds.
 */
static int __init com90io_found(struct net_device *dev)
{
	struct arcnet_local *lp;
	int ioaddr = dev->base_addr;
	int err;

	/* Reserve the irq */
	if (request_irq(dev->irq, arcnet_interrupt, 0, "arcnet (COM90xx-IO)", dev)) {
		BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);
		return -ENODEV;
	}
	/* Reserve the I/O region */
	if (!request_region(dev->base_addr, ARCNET_TOTAL_SIZE, "arcnet (COM90xx-IO)")) {
		free_irq(dev->irq, dev);
		return -EBUSY;
	}

	lp = netdev_priv(dev);
	lp->card_name = "COM90xx I/O";
	lp->hw.command = com90io_command;
	lp->hw.status = com90io_status;
	lp->hw.intmask = com90io_setmask;
	lp->hw.reset = com90io_reset;
	lp->hw.owner = THIS_MODULE;
	lp->hw.copy_to_card = com90io_copy_to_card;
	lp->hw.copy_from_card = com90io_copy_from_card;

	lp->config = (0x16 | IOMAPflag) & ~ENABLE16flag;
	SETCONF();

	/* get and check the station ID from offset 1 in shmem */

	dev->dev_addr[0] = get_buffer_byte(dev, 1);

	err = register_netdev(dev);
	if (err) {
		outb((inb(_CONFIG) & ~IOMAPflag), _CONFIG);
		free_irq(dev->irq, dev);
		release_region(dev->base_addr, ARCNET_TOTAL_SIZE);
		return err;
	}

	BUGMSG(D_NORMAL, "COM90IO: station %02Xh found at %03lXh, IRQ %d.\n",
	       dev->dev_addr[0], dev->base_addr, dev->irq);

	return 0;
}
예제 #5
0
void GPersonality::Init(QString const & strDefaultResolution, QString const & strDefaultPersonalityName) throw (GPersonalityException)
{
	LOG_LEVEL4("Init()");

	QString strPersonalityBaseDir;
	QString strPersonalityPath;
	QString strPersonalityName;
	QString strPersonalityFileName;

	if( (strPersonalityBaseDir=GETCONF_STR(eDisplayManagerPersonalityDir)).isEmpty() )
	{
		throw GPERSONALITY_EXCEPTION(eInvalidPersonalityDir);
	}

	if( strDefaultPersonalityName.isEmpty() )
	{
		if( (strPersonalityName=GETCONF_STR(eDisplayManagerPersonalityName)).isEmpty() )
		{
			LOG_LEVEL1( GPERSONALITY_EXCEPTION(eInvalidDefaultPersonality).GetMessage() );
			strPersonalityName = GDisplayManagerConfig::CSTRAlmostFailProofPersonalityName;
		}
	}
	else
	{
		strPersonalityName = strDefaultPersonalityName;
	}

	m_strResolution = strDefaultResolution;

	{
		bool bTryPersonalityLoad = true;
		while (bTryPersonalityLoad)
		{
			strPersonalityPath = (strPersonalityBaseDir.endsWith("/"))? (strPersonalityBaseDir):(strPersonalityBaseDir+"/");
			strPersonalityPath += strPersonalityName + "/";
			strPersonalityPath += m_strResolution + "/";
			strPersonalityFileName = strPersonalityPath + CSTRConfigFileName;
			m_strPersonalityDir = strPersonalityPath;

			LOG_LEVEL3(QString("[Personality filename=") + strPersonalityFileName + "]");

			try
			{
				if( m_pConfig )
				{
					delete m_pConfig;
					m_pConfig=NULL;
				}

				m_pConfig = new GConfigReader(strPersonalityFileName);

				m_pConfig->Show();
				bTryPersonalityLoad = false;
			}
			catch(GException & e)
			{
				LOG_LEVEL1( QString("GConfigReader::Exception [") + e.GetMessage() + "]" );

				if (strPersonalityName == GDisplayManagerConfig::CSTRAlmostFailProofPersonalityName)
				{
// This was commented because it sysman keeps retrying when DM exits due to this issue, it will leave the unit unusable. Instead, keep looping indefinitely and try again every X seconds.
//					throw GPERSONALITY_EXCEPTION(eCantOpenPersonalityFilename);
					sleep(uikPersonalityLoadFailSleepSeconds);
				}
				else
				{
					strPersonalityName = GDisplayManagerConfig::CSTRAlmostFailProofPersonalityName;
					if ( strDefaultPersonalityName.isEmpty() )
					{
						if ( !(SETCONF(eDisplayManagerPersonalityName, strPersonalityName)) )
						{
							throw GPERSONALITY_EXCEPTION(eInvalidDefaultPersonality);
						}
					}
				}
			}
		}
	}
}