Why is draw_line() not drawing anything on my Verifone Vx display ?

You’re playing with the Verifone eVo/Verix SDK, and are trying to draw a couple of lines on the screen. No big deal you think. You found the draw_line() function, read its (meager) documentation, and tried to use it. Unsuccessfully. Nothing is displayed. If draw_line() returns 0, you probably just messed up with the coordinates or you’re writing with the same color as the background. If the return value is -1, you need to check the errno value. You’ll have two possibilities according to the doc.

If errno = 9 (EBADF)

  • Easy to fix, just open the console using open(DEV_CONSOLE, 0) before calling draw_line()

If errno = 22 (EINVAL)

  • This is trickier. Take a look to the parameters you’re passing to draw_line(), but they are most likely correct. The issue is not with these parameters, but with the display environment. The display coordinates can be expressed in pixels or in character. You can find the configured mode using the get_display_coordinate_mode() function, and change it using set_display_coordinate_mode() with values PIXEL_MODE or CHARACTER_MODE. The issue is that draw_line() doesn’t work in character mode. Just switch to PIXEL_MODE before calling draw_line(), and you’re good to go !

Leave a Reply

Your email address will not be published. Required fields are marked *