UsbConnection.bulkTransfer 返回“-1".这是什么意思? [英] UsbConnection.bulkTransfer returns "-1". What does it mean?
问题描述
根据文档否定响应意味着失败.如何知道出了什么问题?是否有关于错误类型的完整文档?
According to the doc negative response means failure. How to know what's wrong? is there any full doc about error types?
更多好奇:我正在尝试通过 USB 上传 arduino 草图.首先,我通过关闭/打开 DTR/RTS 然后使用 Stk500 协议发送数据来引起引导加载程序的注意.如果通过 USB 在 mac/arduino 上运行(使用 rxtx 串行),它工作正常,所以我认为它应该在 android AS-IS 上运行(只需更改串行),但在 DTR/RTS 切换后无法发送数据.
For more curious: I'm trying to upload arduino sketch via USB. First i'm getting bootloader attention by turning DTR/RTS off/on and then sending data using Stk500 protocol. It's working fine if running on mac/arduino via usb (rxtx serial is used) so i think it should work on android AS-IS (just change serial), but it fails to send the data after DTR/RTS toggling.
推荐答案
来自 bulkTransfer():
退货
成功传输的数据长度(或零),或失败的负值
length of data transferred (or zero) for success, or negative value for failure
因此,如果您收到 -1
,则表示您的数据传输失败.您可以查看 logcat,或使用断点找出原因.
So if you're getting -1
, then it means your data transfer has failed. You could look into the logcat, or work with breakpoints to figure out why.
这篇关于UsbConnection.bulkTransfer 返回“-1".这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!