can a Custom Driver control Printer Motors? - c++

I want to write a driver to control several aspects of my epson printer: e.g. the position of the printer head, and the other motors involved in moving the paper. The ultimate goal is to be able to build a CNC-type machine out of the printer with minimal/no modification of the printer hardware and without the addition of additional microcontrolers.
I've had this goal for a long time, and am just about to begin reading books on drivers to start this project. Is this goal possible?
(For reference, I am planning to do my project on Linux, using an Epson WorkForce WF-M1030 Monochrome Inkjet Printer...however, I think my question applies more generally to the ability to control printer hardware via computer drivers. )

Related

Claim device is not working while using the EPSON TM-T88VI printer once we upgrade it to Advanced driver printer from ADK 270

My POS Terminal has installed the Epson driver ADK 2.70E for model EPSON TM-T88VI.
That time the printer was working fine from my POS Terminal application which is in C++.
The registry contains the key in \HKEY_CLASSES_ROOT\OPOS.POSPrinter
enter image description here
In Device MAnager,
the device is displaying in the USB prot.
enter image description here
In Devices, it is displaying in the Unspecified category,
enter image description here
And from my application it is working fine without any problem.
Then I Installed the advanced driver version APD 512E on top of it.
And then try to print the receipt from my application which uses C++
code the print is not happening.
The OPOS error returning as 106 during the claimDevice funciton.
Device MAnager,
enter image description here
Devices,
enter image description here
If I uninstall the Advanced driver it is working fine from my application, like to know y it not working once we upgrade it to Advanced driver ?
Is there any Language compatibility is there, that c++ is not compatible for this Advanced driver ?
You should be concerned with hardware and software mode settings and related APIs, whether C++ or not.
Advanced Printer Driver and OPOS ADK are exclusive and can be used with only one of the settings.
If you want to use OPOS, delete the TM-T88VI related information from the Windows printer list and printer queue, and uninstall Advanced Printer Driver.
If you want to update OPOS, please get it from the above link and update it.
In response to comments:
As per the question in your comment. However, it depends on the hardware settings. It cannot be handled simply by changing the API used.
If you want to use Advanced Printer Driver, you need to use this utility to change the interface hardware settings from vendor class to printer class.
TM-T88VI Utility
Then print using the standard Windows desktop printer API.
Printing (Documents and Printing)
In that case, you will create image data for each page of the print content and print it as bit image data.
If you want to print using printer fonts, cut paper or open a cash drawer, you will need to create and embed RawPrinterHelper.
Send raw data to a printer by using the Win32 API
Print Direct To Windows Printer (EPOS Receipt)
How to send page cut command to Epson printer
Furthermore:
You probably can't use it like a question in a comment.
is that the behaviour of the driver or any other way to add the device to qindows printer without installing Advance printer drivers ?
To be able to use it as a Windows desktop printer, you need to install some printer driver, even if it is not an Advanced printer driver.
For example, it seems that it is no longer provided in windows 10, but before that there was a generic text only printer driver.
You will need to have some such driver installed.
And perhaps if you install the windows printer driver and create a print queue, it's likely that the connection port will be occupied at system startup and will not be available to others.
This corresponds to the phenomenon of "3. The OPOS error returning as 106 during the claimDevice funciton." In the question.
About: what u mentioning as hardware settings ?
This is the interface mode setting by the TM-T88VI Utility described above.
Printer class or Vendor class of USB.
However, if it is currently available in OPOS, you do not need to consider it.
Rather, it should not be changed.

Is there a way to create a central program that can handle the different RGB components of my computer?

I'm still young but I've been learning software development for about 5 years now and I wanted to write a program that was actually useful to me. I wanted to create a program (preferably in c++ but I would be willing to learn something else if I needed to) that could change the colors of all the RGB components of my computer (light strips, mouse, keyboard, RAM, etc.) without having to open up each individual program and do it manually. I was wondering if there was a way to make one custom, central program that can send requests for color changes to all the components with just one click? Or do all of the company-released software have special access to the drivers that control each device?
Perhaps this would require the reverse engineering of each program to find out their methods for sending data to each device? If so, how would I do this?
If it helps, I'm on windows 10 and my components are:
-NZXT Hue+
-Razer Cynosa Chroma Keyboard
-Redragon M711 Mouse
-G Skill Trident Z Ram
Maybe they need special access, maybe don't. I don't think there are any, but check if your company released open-source drivers. Keep in your mind that reverse engineering is usually license violation, and you should definitely not give the final program to anyone. For reverse engineering: first check that they are native, or .NET-based. In the second situation, it's much easier to reverse-engineer with tools like dotPeek. However, if they are native, then you should have some knowledge in assembly language, and use a disassembler. Also, check if the community created open-source drivers for them; for example, liquidctl is a cross-platform, open-source driver for many NZXT devices like the Smart Device, or the Kraken series.

Translate incoming USB signals to keystrokes/macros

I am looking for a piece of software, or assistance with where to start for coding, that will let you select a USB device and convert its output signals (when buttons are pressed on the device) into keystrokes or configurable macros.
In more detail, I have this remote control (more accurately, a USB handset/phone) that sends USB signals depending on which button is pressed and the software I currently use converts those signals into keystrokes or macros. The software I currently use however is extremely limited, non-configurable and obsolete. The software which I retrieved from the CD that the device came in is simply named 'USBPhone 5 in 1' however there is no mention of this anywhere on the internet.
The device is unfortunately unbranded and also has very little visibility on the internet so I cannot see if there's any updated software or even any way to edit it.
Any help is greatly appreciated!
I think you need to start by getting basic understanding of the USB standard and device classes. Then you need to find out if your device implements a specific device class or some proprietary interfaces. Then you will either need to use a driver for the device class or implement a proprietary driver.
While USB is abbreviation from Universal Serial Bus, it is not transferring some random analogue data but well defined digital packets. The standard defines Audio Class for audio devices, Video class for video devices etc. Most devices implement one or more of those classes. For keyboards and mouse it defines HID class, which is most likely what your device implements. You can find HID device class related specifications here. It is not the most simple one to begin with, but it should work when you just plug the device to your PC and open e.g. notepad and start writing. USB device class codes are listed here.
In order to find out what device class your device implements, you need to read it's descriptors. In Windows one of the easier ways is to use usbview. You can read more about USB decriptors from here.
You do not mention what is your USB host (Windows or Linux PC, Mac or something else), so I am not going to go into actual USB driver implementation, but hopefully I was able to give you some information on what could be needed. In any case, if the device has some proprietary implementation, you will either need to have specification for it, or reverse engineer it by monitoring the USB packets. There are lots of expensive hardware solutions on the market for analyzing the USB traffic, but there are also some free SW solutions that might be good enough for your purpose. Quick Googling brought up this.
You can try joyToKey, this software do exactly what you want but with gamedpad. I don't know if it will work well with your USB controller.
http://joytokey.net/en/

How to use Mac OS X audio API functions?

When reading about the Mac OS X audio API, they seem to list quite a few functions, but not (that I can find) how to use them.
For instance, they list a subclass, IOAudioLevelControl. Should I just create an object with this, and assume that it controls the audio level? And if so, what should I assume? That it has a constructor that sets the audio level, so I should declare them IOAudioLevelControl levelControl(5);?
I'm very confused here.
Edit: My goal is to make a program that detects the audio level of all the running programs(like Chrome when you play music from Youtube etc) and lower the level if it goes over a certain level, set by the user.
IOKit is way too low level - it's the user-space proxy for device drivers on the system. MacOSX provides several layers that sit about this. Most likely, you can use these APIs directly without being root.
Core Audio provides the next layer up in the stack. The diagram on this page shows the architecture.
Setting CoreAudio are higher level APIs such as Audio Units and AVFoundation. It is likely that are what you want.

Why can't I set master volume for USB/Firewire Audio interface with IAudioEndpointVolume::SetMasterVolumeLevelScalar

I am trying to fix an Audacity bug that revolves around portmixer. The output/input level is settable using the mac version of portmixer, but not always in windows. I am debugging portmixer's window code to try to make it work there.
Using IAudioEndpointVolume::SetMasterVolumeLevelScalar to set the master volume works fine for onboard sound, but using pro external USB or firewire interfaces like the RME Fireface 400, the output volume won't change, although it is reflected in Window's sound control panel for that device, and also in the system mixer.
Also, outside of our program, changing the master slider for the system mixer (in the taskbar) there is no effect - the soundcard outputs the same (full) level regardless of the level the system says it is at. The only way to change the output level is using the custom app that the hardware developers give with the card.
The IAudioEndpointVolume::QueryHardwareSupport function gives back ENDPOINT_HARDWARE_SUPPORT_VOLUME so it should be able to do this.
This behavior exists for both input and output on many devices.
Is this possibly a Window's bug?
It is possible to workaround this by emulating (scaling) the output, but this is not preferred as it is not functionally identical - better to let the audio interface do the scaling (esp. for input if it involves a preamp).
The cards you talk about -like the RME- ones simply do not support setting the master or any other level through software, and there is not much you can do about it. This is not a Windows bug. One could argue that giving back ENDPOINT_HARDWARE_SUPPORT_VOLUME is a bug though, but that likely originates from the driver level, not Windows itself.
The only solution I found so far is hooking up a debugger (or adding a dll hook) to the vendor supplied software and looking at the DeviceIOControl calls it makes (those are the ones used to talk to the hardware) while setting the volume in the vendor software. Pretty hard to do this for every single card, but probably worth doing for a couple of pro cards. Especially for Audacity, for open source audio software it's actually not that bad so I can imagine some people being really happy if the volume on their card could be set by it. (at the time we were exclusively using an RME Multiface I spent quite some time in figuring out the DeviceIOControl calls, but in the end it was definitely worth it as I could set the volume in dB for any point in the matrix)