question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement Reading and Writing N Bytes

See original GitHub issue

Hi,

Is it possible to implement reading and writing n bytes from/to a device more like a Stream? Something like this:

Read(byte[] buff, int offset, int read)
Write(byte[] buff, int offset, int len)

Thanks.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:26 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
mxjonescommented, Jul 4, 2019

@MelbourneDeveloper Hey, I remembered reading this whilst I was playing with the other work in #19 - as I was testing I found something in relation to this…

@realivanjx I’m not sure if the code does call WinUsb_GetPipePolicy . It’s currently getting the buffer sizes from the descriptor with WinUsb_GetDescriptor. Maybe this is just wrong, but I need to investigate.

It would be really awesome if you could fix the problem and submit a pull request.

The Read & Write buffer size for my device from the descriptor is 64, which didn’t seem right to me (same as reported here) - after looking a bit more it seems like the correct values are being returned for each specific endpoint by the WinUsb_QueryPipe call (WINUSB_PIPE_INFORMATION.MaximumPacketSize) - which for me is:

Read: 512 Write: 512 Interrupt: 8

Not sure if this is only for the device I’m using though

1reaction
ivanjxcommented, Jul 1, 2019

ok then. for now i will just use the debug version of it not really a big deal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Read N bytes from a file and print it using read() and write()
I'm trying to read a program that reads N bytes from a file using read() and prints them in STDOUT using write(). The...
Read more >
Reading and Writing Raw Bytes to Files in C - YouTube
In this video, I demonstrate how to read and write to files in C as well as how to do so with ......
Read more >
read()--Read from Descriptor
Reading and writing to files with the Network File System relies on byte-range locking to guarantee data integrity. To prevent data inconsistency, use...
Read more >
Python - Write Bytes to File
File handling is performing various operations (read, write, ... Next, use the write function to write the byte contents to a binary file....
Read more >
Reading and writing files in Go
Reading and writing to the filesystem are one of the basic things a programming language needs to do. ... Read(p []byte) (n int,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found