cancel
Showing results for 
Search instead for 
Did you mean: 

Custom USB HOST Driver: Printer Class

Vivek yadav1
Associate III

Hi,

# General INFO:

I made a custom USB Host Driver for Printer class using STM32F407 - Discovery Board. For This I use HAL Library. I knew that many people don't like this HAL library. I may understand if you guide me through bare-metal programming.

When I connect my printer(Honeywell) to my USB Host. I am successfully able to connect , enumerate and able to send/receive class specific request. Even when I send data to my printer using send bulk data API. I get print also. But This happen only once. Next time If I tried to send data It goes.but do not print anything.

Now you may ask how can I know that data is reaching to printer? I know because Printer indicates by bilking its LED.

# Problem :

@1: I want to know that Is there any command which specify to printer that my data has finish. Now printer can print.

@2: As far as I know. Printer has buffer So that It can store receive data. and Later it print using this buffer. Now my Question is that Can I empty this buffer by sending any command to my printer?

@3: After sending data to printer. How will I know that printer has received data successfully?

To know this I am polling USBH_LL_GetURBState(phost, PRT_Handle->OutPipe) == USBH_URB_DONE). Am I doing right or any other thing I should consider?

@4: When I send GET_PORT_STATUS(class specific) request to my printer. It returns 4 Bytes data. but USB specification mention only 1 Byte. Am I missing anything?

Thanks

#USB​ 

1 REPLY 1
Vivek yadav1
Associate III

I have solved my problems. Although there are many questions still there which will resolve slowly.

Now I have tested my code over 4 different type of printers including Dot Printer and Laser printer. All are working as expected.

Now I can announce that I have made my first printer class USB Host Driver using HAL library.