掌機 - Miyoo Flip - 解決xrock usb bulk send error問題



問題如下:

$ ./xrock extra maskrom --rc4 off --sram ../rk3566_ddr_1056MHz_v1.18.bin --delay 10 --rc4 off --dram ../rk356x_usbplug_v1.17.bin --delay 10
$ ./xrock flash
    Flash info:
        Manufacturer: Samsung (0)
        Capacity: 127MB
        Sector size: 512
        Sector count: 261120
        Block size: 128KB
        Page size: 2KB
        ECC bits: 0
        Access time: 40
        Flash CS: <0>
        Flash ID: 53 4e 41 4e 44

$ ./xrock flash read 0 261120 spi.img
    usb bulk send error

解法如下:

$ vim rock.c
    static inline void usb_bulk_recv(libusb_device_handle * hdl, int ep, void * buf, size_t len) 
    {
        int r, bytes;

        while(len > 0) 
        {    
            r = libusb_bulk_transfer(hdl, ep, (void *)buf, /*len*/512, &bytes, 2000);

$ make
$ ./xrock flash read 0 261120 spi.img
    100% [================================================] 127.500 MB, 7.458 MB/s