整体方案设计思路非常简单:鼠标的USB进入CH334 USB HUB 芯片之后,转出来2路USB信号,一路给PAW3515芯片,这是一个鼠标芯片;另外一路给CH552。我们通过编程,让Ch552将自身模拟为鼠标和键盘设备。Ch552键盘设备用于接收主机发过来的键盘LED控制信号;Ch552鼠标设备则是用于模拟鼠标的动作。
电路图如下,左上角是PAW3515鼠标的最小系统,右上角是Ch334 USB Hub芯片的最小系统,下方则是Ch552的最小系统。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NAudio;
using NAudio.Wave;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
for (int n = 0; n < WaveOut.DeviceCount; n++)
{
Console.WriteLine(n + " : " + WaveOut.GetCapabilities(n).ProductName);
}
while (true)
{
int i = 0;
do
{
Console.WriteLine("Choose device:");
} while (!int.TryParse(Console.ReadLine(), out i) || i >= WaveOut.DeviceCount || i < 0);
WaveOutEvent waveOutEvent = new WaveOutEvent();
waveOutEvent.DeviceNumber = i;
Console.WriteLine("Play on "+WaveOut.GetCapabilities(i).ProductName);
using (var audioFileReader = new AudioFileReader(@"c:\temp\1990.mp3"))
{
// Play mp3 in the device
waveOutEvent.Init(audioFileReader);
waveOutEvent.Play();
// Wait until the end
while (waveOutEvent.PlaybackState == PlaybackState.Playing)
{
System.Threading.Thread.Sleep(100);
}
}
}
}
}
}
Each file begins with a header that describes the state and contents of the file. The header is 8-byte aligned with respect to the beginning of the firmware volume.
上述的区别在于“EFI_FIRMWARE_FILE_SYSTEM3_GUID indicates support for FFS_ATTRIB_LARGE_SIZE and thus support for files 16MB or larger. EFI_FIRMWARE_FILE_SYSTEM2_GUID volume does not contain large files. Files 16 MB or larger use a EFI_FFS_FILE_HEADER2 and smaller files use EFI_FFS_FILE_HEADER.EFI_FIRMWARE_FILE_SYSTEM2_GUID allows backward compatibility with previous versions of this specification”,这里因为文件小,肯定是EFI_FFS_FILE_HEADER。