| |

VerySource

 Forgot password?
 Register
Search
Author: qfx001

HID devices read and write data to the USB port? ?

[Copy link]

1

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-8-14 22:45:01
| Show all posts
I only need to be responsible for receiving and transmitting data, mainly through an agreement: the command determines which data to receive or which data to send. Will I start to read the command data after I have identified the USB interface ID? Because only after reading the relevant commands, my application can respond accordingly? ?
Reply

Use magic Report

0

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-15 00:15:01
| Show all posts
I understand it this way, right?
For example, you send a command to the device and ask the device to send data back, and then you use ReadFile to receive the data
Next command, then do the corresponding processing

The whole process should be started by your program, it shouldn't be difficult to do
Reply

Use magic Report

1

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-8-15 08:30:01
| Show all posts
What you are talking about is the part where I write data and send data. This part is still relatively easy to handle, similar to the method you mentioned. My problem now is: the entire program is not only controlled by my PC application, but my program is compatible with the phone on the other end of the USB. When only the phone on the USB end is operating, the phone on the other end is Will send a command, then my application has to read the sent command data and automatically perform corresponding operations. In short, as long as the phone is operated, it means that a new command is sent, so there is no definite time to send a data command. I don't know when to call Readfile to read the command data sent by the phone? ? ? ?
Reply

Use magic Report

0

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-15 13:30:01
| Show all posts
In this way, it is estimated that we need to write a driver. The driver will continuously read the device data, and then communicate with the root application according to the method I reposted.

If you keep reading the device directly in the user program, it is probably not very good.

Hehe, I don't have much contact with me, so I can only give some suggestions
Reply

Use magic Report

0

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 Invalid IP Address

Post time: 2020-8-15 13:45:01
| Show all posts
You can read it with a timer and test it
Reply

Use magic Report

1

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-8-15 19:45:01
| Show all posts
Thank you!
Do you know how to control with threads? No timer
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-22 16:30:01
| Show all posts
Hello, poster. How did you write the code for establishing communication? Can you post it?
I downloaded several examples about HID communication from the Internet. It took a lot of effort to compile and pass. The enumerated HID is not correct. I wrote it in delphi. It is normal. I took a closer look. It may be the unicode of VS. The functions used in the SetupDiGetClassDevsW class are changed to SetupDiGetClassDevsA, but it still doesn’t work and it’s very depressing. I hope the host can post some communication codes. Thank you
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-25 22:00:01
| Show all posts
Encountered the same problem, please click...
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-5 23:00:01
| Show all posts
I used C# to make a USB HID read and write tool. It can be used in 32-bit systems, but not in 64-bit systems. Please advise me. My QQ: 346036029, thank you, urgent
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-6 01:15:01
| Show all posts
Now the problem is solved, but it is possible to send data to HID, but the data will be lost when receiving it, and when I am debugging at a breakpoint, HID is still sending data to me, some of the data is overwritten, please Master
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list