您好!
我想在如何进行 Mediainfo 更新方面寻求一些帮助。
我只是 USB 编程的乞丐。 I 寄存器 CDC 和 MSC 端点。 通过 FatFs 更新文件使用 CDC。 在首次读取时、Linux 正确读取文件内容、但我得出结论、应该在以后通知 API 文件已被更改。
我想问一些帮助、如何向系统通报这一变化。
提前感谢您、
Laszlo
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
我想在如何进行 Mediainfo 更新方面寻求一些帮助。
我只是 USB 编程的乞丐。 I 寄存器 CDC 和 MSC 端点。 通过 FatFs 更新文件使用 CDC。 在首次读取时、Linux 正确读取文件内容、但我得出结论、应该在以后通知 API 文件已被更改。
我想问一些帮助、如何向系统通报这一变化。
提前感谢您、
Laszlo
您好 Laszlo、
这种类型的功能需要添加到您的文件系统软件(FatFs)和应用程序代码中。 除此之外、您可以执行 changelog 文件、但这似乎很麻烦。
MSP430 USB API 只处理 USB 堆栈和数据传输。 您的应用程序应确定要传输的数据是否正确、或者是否是最新的数据。 有关 MSC 实现的更多信息,请参阅《MSP430 USB 程序员指南》(位于 www.ti.com/.../MSP430USBDEVPACK 内)的第8节。
您好 Jace、
我已根据程序员指南中的说明修改了程序。 不幸的是、更糟糕的是、它在第一次写入后被阻止-没有更新。 您能不能看一下相关代码、我不确定我对方向的理解是否正确。
switch (USB_getConnectionState())
{
// This case is executed while your device is enumerated on the
// USB host
case ST_ENUM_ACTIVE:
USBMSC_processMSCBuffer(); // Handle READ/WRITE cmds from the host
// Every second, the Timer_A ISR sets this flag. The
// checking can't be done from within the timer ISR, because it
// enables interrupts, and this is not a recommended
// practice due to the risk of nested interrupts.
if (bDetectCard){
USBMSC_checkMSCInsertionRemoval();
// Clear the flag, until the next timer ISR
bDetectCard = 0x00;
}
if (bCDCDataReceived_event){
// Clear flag early -- just in case execution breaks
// below because of an error
bCDCDataReceived_event = FALSE;
count = USBCDC_receiveDataInBuffer((uint8_t*)message, 32, CDC0_INTFNUM);
USBCDC_sendDataInBackground((uint8_t*)message, count, CDC0_INTFNUM, 1);
for( i = 0; i < count; i++) {
strcat((char *)command, (char *)&message[i]);
if ( message[i] == '\x0D' ) command_received = TRUE;
strcat((char *)command, (char *)"\x00");
}
}
if (command_received) {
command_received = FALSE;
f_mount(0, &FatFs);
fr = f_open( &fd, filename, FA_WRITE);
f_stat( filename, &fi );
f_lseek( &fd, fi.fsize );
if ( fr == FR_OK ) {
f_write( &fd, command, strlen((const char *)command), &nob_written );
f_sync( &fd );
fr = f_close( &fd );
}
f_mount(0, NULL);
*command='\x00';
mI.mediaPresent = USBMSC_MEDIA_PRESENT;
mI.mediaChanged = TRUE;
mI.writeProtected = 0x00;
disk_ioctl(0,GET_SECTOR_COUNT,&mI.lastBlockLba);
mI.bytesPerBlock = BYTES_PER_BLOCK;
USBMSC_updateMediaInformation( 0, &mI);
}
break;
// These cases are executed while your device is disconnected from
// the host (meaning, not enumerated); enumerated but suspended
// by the host, or connected to a powered hub without a USB host
// present.
case ST_PHYS_DISCONNECTED:
case ST_ENUM_SUSPENDED:
case ST_PHYS_CONNECTED_NOENUM_SUSP:
// __bis_SR_register(LPM3_bits + GIE);
_NOP();
break;
// The default is executed for the momentary state
// ST_ENUM_IN_PROGRESS. Usually, this state only last a few
// seconds. Be sure not to enter LPM3 in this state; USB
// communication is taking place here, and therefore the mode must
// be LPM0 or active-CPU.
case ST_ENUM_IN_PROGRESS:
default:;
}
您好 Laszlo、
通过遵循 USB 库中的 MSC 示例/交叉检查、尝试返回到已知正常状态。 https://dev.ti.com/tirex/explore/node?node=ACRg-lXAVWco7CfffvwKsg__IOGqZri__LATEST