Forum Rule: Always post complete source code & details to reproduce any issue!
Page 39 of 39 FirstFirst ... 29 37 38 39
Results 951 to 963 of 963

Thread: MTP Responder Contribution

  1. #951
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,265
    @Fluxanode
    two answers here
    - do not use Sdfat.h but only SD.h, which since recently uses Sdfat internally.
    - teensy is a mtp responder and therefore has no control in what PC (the master or initiator) knows about the existing files.
    in particular, when teensy is adding files (during data acquisition) , PC will not know about this. The MTP protocol is designed to transfer existing files and not to monitor a device.
    Under normal circumstances, Teensy should only reply to PC requests. However, there are some possibilities that teensy informs PC that situation has changed. One of this options is to reset completely the MTP. this is done in mtp-basic by receiving the letter 'r' from the PC.

    two comments:
    better not to call mtpd.loop() while in acquisition mode, it is useless. better to call this function only when acquisition is stopped.
    you may check with mtp-logger.ino how this could be done.

  2. #952
    Senior Member
    Join Date
    Feb 2020
    Posts
    106
    Thanks again for the help, let me mull this over.
    I'm sure I'll have more questions, thanks for your patience with my rookie questions.

    BTW where is the mtpd_loop() in your source code?
    Can I call mtpd_loop() from a menu item?
    Does it need to be in a loop and how does it exit when finished?
    Is there a method to send the reset 'r' from the program rather than serial monitor?
    Last edited by Fluxanode; 07-02-2021 at 05:29 PM.

  3. #953
    Senior Member
    Join Date
    Feb 2020
    Posts
    106
    @WMXZ
    BTW where is the mtpd_loop() in your source code?
    Can I call mtpd_loop() from a menu item?
    Does it need to be in a loop and how does it exit when finished?
    Is there a method to send the reset 'r' from the program rather than serial monitor?

  4. #954
    Senior Member
    Join Date
    Feb 2020
    Posts
    106
    @WMXZ - Is there a method to send the reset 'r' from the program rather than serial monitor?

    I found my answer to that question... mtpd.send_DeviceResetEvent() Where is this function located?
    Last edited by Fluxanode; 07-06-2021 at 07:51 PM.

  5. #955
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,265
    mtp.loop() is in the MTP.cpp file and similar to loop() must be called continuously to service each PC mtp request.

    mtp.loop() contains a mtp protocol interpreter. that's all.
    where you loop you call it, its up to you. but to service PC MTP request you must call it continuously. If there are no requests, mtp.loop() simply exits.

    Is there a method to send the reset 'r' from the program rather than serial monitor?
    PC sends 'r' (or any command to tell Teensy to send reset event) and teensy sends reset event over MTP back to PC.

    of course, on PC you can unmount/mount the MTP portable device to do the same. But this is all discussed earlier in this thread.

  6. #956
    Senior Member
    Join Date
    Feb 2020
    Posts
    106
    Ok how do I unmount the MTP device in windows?

  7. #957
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,265
    Quote Originally Posted by Fluxanode View Post
    Ok how do I unmount the MTP device in windows?
    read the readme on github repository

  8. #958
    Senior Member
    Join Date
    Feb 2020
    Posts
    106
    Is there a way to unmount other than device manager? Maybe using a batch file, script or in a program?

  9. #959
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,265
    Quote Originally Posted by Fluxanode View Post
    Is there a way to unmount other than device manager? Maybe using a batch file, script or in a program?
    did you look under scripts?

  10. #960
    Senior Member
    Join Date
    Feb 2020
    Posts
    106
    No, is there something there to unmount?
    is that the reset script?
    Last edited by Fluxanode; 07-07-2021 at 06:50 PM.

  11. #961
    Senior Member
    Join Date
    Feb 2020
    Posts
    106
    Nevermind I see now. So I just edited it to disable and that works! Thanks!

  12. #962
    Senior Member
    Join Date
    Feb 2020
    Posts
    106
    @WMXZ - FYI, tried to compile the mtp-logger example to a teensy 3.2 and received the following compile errors.

    D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino:155:26: warning: invalid conversion from 'long unsigned int (*)()' to 'getExternalTime {aka long int (*)()}' [-fpermissive]
    setSyncProvider(rtc_get);
    ^
    In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time/time.h:2:0,
    from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\stat.h:9,
    from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\_default_fcntl.h:188,
    from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\fcntl.h:4,
    from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\fcntl.h:1,
    from c:\program files (x86)\arduino\hardware\teensy\avr\libraries\sdfat\ src\common\fsapiconstants.h:30,
    from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat\ src/ExFatLib/ExFatFile.h:36,
    from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat\ src/ExFatLib/ExFatVolume.h:28,
    from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat\ src/ExFatLib/ExFatLib.h:27,
    from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat\ src/SdFat.h:33,
    from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD\src/SD.h:27,
    from D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino:18:
    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time/TimeLib.h:134:9: note: initializing argument 1 of 'void setSyncProvider(getExternalTime)'
    void setSyncProvider( getExternalTime getTimeFunction); // identify the external time provider
    ^
    D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino: In function 'int16_t acq_check(int16_t)':
    D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino:944:17: error: 'acq_start' was not declared in this scope
    acq_start();
    ^
    D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino:948:16: error: 'acq_stop' was not declared in this scope
    acq_stop();
    ^
    Using library SD at version 2.0.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
    Using library SdFat at version 2.0.5-beta.1 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat
    Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI
    Using library MTP_t4-master at version 1.0.0-beta.1 in folder: D:\ChuckW\Arduino\libraries\MTP_t4-master
    Using library Time at version 1.6.1 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time
    Error compiling for board Teensy 3.2 / 3.1.

  13. #963
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,265
    Quote Originally Posted by Fluxanode View Post
    @WMXZ - FYI, tried to compile the mtp-logger example to a teensy 3.2 and received the following compile errors.
    Because it is coded for T3.5/T3.6. If really required, I suggest potential users modify the code to run on T3.2. This way the user learns the concept behind the mtp-logger.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •