Do not override the protocol version if the user sets a low value.
Set the custom protocol version on the wireless broadcast too.
This commit is contained in:
		@@ -42,7 +42,6 @@ bool DeviceCapability::exchangeInfo(vita_device_t *device)
 | 
			
		||||
 | 
			
		||||
    QString hostname = QHostInfo::localHostName();
 | 
			
		||||
    int protocol_version = QSettings().value("protocolVersion", VITAMTP_PROTOCOL_MAX_VERSION).toInt();
 | 
			
		||||
    protocol_version = qMax(protocol_version, VITAMTP_PROTOCOL_MAX_VERSION);
 | 
			
		||||
    const initiator_info_t *pc_info = VitaMTP_Data_Initiator_New(hostname.toUtf8().data(), protocol_version);
 | 
			
		||||
 | 
			
		||||
    // Next, we send the client's (this program) info (discard the const here)
 | 
			
		||||
 
 | 
			
		||||
@@ -85,10 +85,12 @@ void CmaBroadcast::readPendingDatagrams()
 | 
			
		||||
void CmaBroadcast::setAvailable()
 | 
			
		||||
{
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
    int protocol_version = QSettings().value("protocolVersion", VITAMTP_PROTOCOL_MAX_VERSION).toInt();
 | 
			
		||||
 | 
			
		||||
    reply.clear();    
 | 
			
		||||
    reply.insert(0, broadcast_reply
 | 
			
		||||
                 .arg(broadcast_ok, uuid, "win", hostname)
 | 
			
		||||
                 .arg(VITAMTP_PROTOCOL_MAX_VERSION, 8, 10, QChar('0'))
 | 
			
		||||
                 .arg(protocol_version, 8, 10, QChar('0'))
 | 
			
		||||
                 .arg(QCMA_REQUEST_PORT)
 | 
			
		||||
                 .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0')));
 | 
			
		||||
    reply.append('\0');
 | 
			
		||||
@@ -97,10 +99,12 @@ void CmaBroadcast::setAvailable()
 | 
			
		||||
void CmaBroadcast::setUnavailable()
 | 
			
		||||
{
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
    int protocol_version = QSettings().value("protocolVersion", VITAMTP_PROTOCOL_MAX_VERSION).toInt();
 | 
			
		||||
 | 
			
		||||
    reply.clear();
 | 
			
		||||
    reply.insert(0, broadcast_reply
 | 
			
		||||
                 .arg(broadcast_unavailable, uuid, "win", hostname)
 | 
			
		||||
                 .arg(VITAMTP_PROTOCOL_MAX_VERSION, 8, 10, QChar('0'))
 | 
			
		||||
                 .arg(protocol_version, 8, 10, QChar('0'))
 | 
			
		||||
                 .arg(QCMA_REQUEST_PORT)
 | 
			
		||||
                 .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0')));
 | 
			
		||||
    reply.append('\0');
 | 
			
		||||
 
 | 
			
		||||
@@ -101,8 +101,6 @@ void ConfigWidget::setDefaultData()
 | 
			
		||||
    ui->musicSkipCheck->setChecked(settings.value("musicSkip", false).toBool());
 | 
			
		||||
 | 
			
		||||
    int protocol_version = settings.value("protocolVersion", VITAMTP_PROTOCOL_MAX_VERSION).toInt();
 | 
			
		||||
    protocol_version = qMax(protocol_version, VITAMTP_PROTOCOL_MAX_VERSION);
 | 
			
		||||
 | 
			
		||||
    ui->protocolEdit->setText(QString::number(protocol_version));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -190,7 +188,7 @@ void ConfigWidget::accept()
 | 
			
		||||
    settings.setValue("photoSkip", ui->photoSkipCheck->isChecked());
 | 
			
		||||
    settings.setValue("videoSkip", ui->videoSkipCheck->isChecked());
 | 
			
		||||
    settings.setValue("musicSkip", ui->musicSkipCheck->isChecked());
 | 
			
		||||
    settings.setValue("protocolVersion", ui->protocolEdit->text().toLongLong());
 | 
			
		||||
    settings.setValue("protocolVersion", ui->protocolEdit->text().toInt());
 | 
			
		||||
    settings.sync();
 | 
			
		||||
 | 
			
		||||
    done(Accepted);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user