How does an OS communicate with device drivers - driver

I know that an OS provides an api for a device driver to access the configuration space so that the device driver knows the memory addresses assigned to the device and can control the device. However, my question is how does an OS communicate with device drivers? For example, let's say the OS wants a document to be printed. How does it tell that it wants a document to be printed to the printers device driver and provide the driver with the text to print? Device drivers are developed by different developers, so wouldn't the drivers expect different types or formats of data from an OS. For example, printer A's driver may expect the command byte before the text data but printer B's driver may expect the text data before the command byte.

Related

Control what services are published by Avahi?

I've configured a print server on Raspbian (Jessie) using CUPS, SAMBA and Avahi to publish a USB printer to iOS devices. It works fine except when it comes time to actually print, the printer isn't found. (even after selecting the printer in the Printer Options dialog in iOS.)
I believe this is either related to 1) multiple services with the same name being published by Avahi 2) some kind of timeout between printer selection and printing or 3) the address of the printer changing somehow at each access.
In order to explore the first problem, I'd like to try to disable all but the _ipp._tcp. service for the printer. (simply by sharing a printer in CUPS, I get a Printer#Server over _ipp._tcp., _ipps._tcp. and _printer._tcp.)

About Jasper IoT Platform

I am just bit curious. I am new in IoT and currently started working on it using ESP8266 device. I know that it needs some firmware to write and install, like smart.js.
But I have read, Jasper (http://www.jasper.com/) can connect any device and manager, monitor etc. So I am bit curious how it works internally. I am not sure whether it installs firmware created by Jasper or in other way. I was reading this article: http://www2.cumulocity.com/guides/users-guide/jasper/#link-sims
Anyone knows about this? I mean how Jasper works to connect to any devices?
Cisco bought Jasper, which is useful for IoT business. However it might be better way for you to check Interactor(www.interactor.com) which is great for IoT development. Interactor works to conntect to any device with any protocol.
Cisco Jasper should not be confused with device management libraries (whether they be server based, or device based or both).
Jasper is a telecom based service that allows you to see and manage the connection state of sim inserted in the device. Regardless of the state of a device, the modem and sim (provided they are powered) will connect to the telco and provide basic information about the connection.
Think of it as a network tool (server originated) for the gateway on the device, not the device itself. It allows you to force disconnect devices from the network, ban sims from the account so a stolen or runaway sim can eat through data, basic connectivity tests (is the modem powered, does the sim have permission to transmit data over the network, etc).
The main value of jasper is that it allows you to manage you data costs by applying the appropriate rate plan to each device, and disconnect devices that are using too much (for whatever reason).
Jasper does not cost anything to use, however telcos will apply a rev commit (min monthly spend) usually $500/month to gain access. the sims are the same as PCS (phone) sims, but they are on their own network internally, and are specific to that telcos jasper. i.e. you can't take 500 devices using PCS sims, and import those sims into jasper. you'd need to do a physical swap of the sims.

cellular modem data session via "ethernet" adapter?

Most USB cellular modems present as a composite device containing (amongst other things) a modem and a network adapter. The latter shows up under the "LAN or High-Speed Internet" heading in Network Connections (and under Network Adapters in Device Manager).
I know how to initiate a data session on the modem interface using standard AT commands, but I am looking for information or documentation on (programmatically) using the network adapter.
My modems are a ZTE MF626i and a Sierra Wireless USB 301. I would happy with documentation that was either general in nature or specific to these modems.
Edited to add: I'm using Windows XP, so no Mobile Broadband API.
Assuming you're using Windows 7 or 8, you can use the built in Windows interface.
Use the VID and PID to identify the device amongst the Windows Network Adapters (find the VID and PID manually by inspecting the network adapter properties in Windows Device Manager).
Once you know the device, you can get the Windows device id programmatically.
Then use Windows Mobile Broadband API together with the device id to make data connections via the network adapter.
http://msdn.microsoft.com/de-de/library/windows/desktop/dd323269(v=vs.85).aspx

Bluetooth printing via SPP from microcontroller

We've got a self-built mobile device which can transfer data via Bluetooth SPP to a PC. On the market there are numerous devices acting as mobile printers via Bluetooth. Some of them use a custom ASCII-based printing language, e.g. the label printers from Zebra.
So there is the idea of printing via SPP from our device.
Sadly there is not too much usable information on the internet on this special topic.
Can you recommend any printer (at least A4) capable of printing via Bluetooth SPP with publicly available protocol specs?
Or do you have any hints where to start?
Bluetooth printers typically use profiles other than SPP. There are several flavors, some printers will support a variety of them:
1) BPP - Basic Print Profile can send simple text-based data, no need for printer-specific drivers
2) HCRP - Hard Copy Cable Replacement Profile is used to send the same data format as you would over a wire, typically requires printer-specific drivers to format the data.
3) BIP - Basic Imaging Profile allows transfer of photos, etc.
4) OPP - Object Push Profile is also sometimes used to transfer files
So in general, you are not going to be able to just use SPP to talk to a normal printer, although these other profiles may sit on top of SPP.

Windows device manager and hardware IDs

I'm curious how the windows device manager obtains the hardware IDs for a device, even though no device driver may be loaded for the device yet. Anybody have a clue on how Windows goes on about this?
On a related note, I am interested in supporting language localization for the software we are writing; is it possible for a device and/or driver to report back its friendly name and description in a localized fashion? Is there a common practice for this already?
Thanks for your time.
First, to understand the order of drivers being loaded, you're recommended to switch the Device Manager into View | Devices by Connection mode.
As you would notice, the devices are located below their bus driver. For PCI devices, it'll be "PCI bus". For USB devices, it would be their USB hub. Each bus driver has its own idea about how the identifier strings should be formatted:
Device Instance Id
Hardware Ids
Compatible Ids
Location, etc.
It returns them in response to IRP_MN_QUERY_ID (BusQueryInstanceID, BusQueryHardwareIDs, BusQueryCompatibleIDs) and IRP_MN_QUERY_DEVICE_TEXT (DeviceTextDescription, DeviceTextLocationInformation etc.)
Of course, since the bus driver enumerated the devices (i.e. created the child devices you're seeing) in the first place (through whatever standard interface appropriate for the bus; e.g. 'Get Device/String Descriptor' on USB), it knows their vendor ID, product ID etc.
The device's driver does not have to be loaded at this time. In fact, it can't be loaded. The device IDs are precisely what instructs the PnP system as to which driver matches the device.
As to localization:
Unlike IRP_MN_QUERY_ID, which provides opaque strings intended for device matching, the IRP_MN_QUERY_DEVICE_TEXT information was indeed intended to be localized. For that purpose, you receive the requested Locale ID (LCID) in the input data (Parameters.QueryDeviceText.LocaleId).
[As Alphaneo noted, a USB hub driver might pass this LCID onwards to the USB device (within a Get String Descriptor request), hoping that the USB device itself has localized strings.]
The top level process is called enumeration. Most modern device buses support a mechanism that lets the OS query the buss and determine what devices are connected to the bus.
The PCI family of buses all support enumeration. The PCI bus has a special enumeration space just for this. This is where "Plug-n-Play" ID's come from.
The device id's uniquely identify a device on the bus and enable the OS to find the correct driver for that device.
Other buses, including USB and FireWire have enumeration strategies
Device ID, is a combination of information given from the device. For example, for a USB device, the string is based on the VID and PID (Vendor ID and Product ID). Now, this cannot happen if no driver is loaded. Atleast some driver, bus driver would have to be loaded for the OS to get the Device ID.
Now, for language support, I guess for WDM driver, there is a QUERY_LANG or something, I dont remember properly, alternatively some devices like USB, have Language ID support. This language ID determines the language of the Product descriptor string.
Please note that there is a difference between the hardware identifier/serial number and the true unique hardware ID. Maybe this will explain it better:
http://www.soft.tahionic.com/download-hdd_id/hardware%20ID%20programmer%27s%20DLL.html

Resources