So, using the usbmon kernel module, and usbmon userland tool, I started sniffing USB traffic, and then launched VirtualBox and started up my XP VM.
This seems to be a little bit easier than using USB Snoopy in the XP VM itself. And it confirmed a few things I was already suspecting:
Earlier versions seem to use an OUT endpoint to communicate with the LCD, whereas this version does virtually all of its communication with the control endpoint instead. I was able to modify the code from this blog:
http://martian.org/marty/2007/12/14/imo ... tems-case/ so that it works with the 0x0038 device. RXM307, can you try this code, modifying the Product ID to be 0x0036 instead, and see if it works for you?
This code simply blanks the screen, sets the contrast, and displays the top and bottom horizontal lines:
/* imon-poke: send 16 byte commands to your imon LCD device.
*
* Copyright (C) 2007 Marty Pauley
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* I compile this with on GNU/Linux with:
* gcc -std=gnu99 imon-poke.c -lusb -o imon-poke
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <usb.h>
void die(const char *msg)
{
fprintf(stderr, msg);
exit(1);
}
int config = 1;
int iface = 0;
int ep = 0x81;
#define DEV_VENDOR_ID 0x15c2
#define DEV_PRODUCT_ID 0x0038
#define try(something) if((erc = something) < 0) { printf(#something " failed: [%i] %s\n", erc, usb_strerror()); exit(1); }
void poke_device(struct usb_device *dev, char *packet, int size)
{
int erc, i;
usb_dev_handle *dh;
dh = usb_open(dev);
if (!dh) die("cannot open device\n");
try(usb_claim_interface(dh, iface));
try(usb_clear_halt(dh, ep));
for(i = 0; i < size; i+=8)
{
try(usb_control_msg(dh, 0x21, 0x09, 0x0200, 0x0001, packet + i, 8, 1000));
if (erc < 0)
{
printf("Err = %i\n", erc);
die("write failed\n");
}
usleep(50000);
}
try(usb_release_interface(dh, iface));
try(usb_close(dh));
}
struct usb_device *find_device(void)
{
usb_init();
usb_find_busses();
usb_find_devices();
struct usb_bus * bus;
struct usb_device *dev;
for (bus = usb_busses; bus; bus = bus->next) {
for (dev = bus->devices; dev; dev = dev->next) {
if (dev->descriptor.idVendor == DEV_VENDOR_ID && dev->descriptor.idProduct == DEV_PRODUCT_ID) {
return dev;
}
}
}
}
#define SIZE 64
int main(int argc, char **argv)
{
struct usb_device *dev;
int i;
char packet[SIZE] = {
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, // initialize (disable clock, blank?)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, // initialize contd
0x12, 0x00, 0x00, 0x00, 0xe8, 0x70, 0x08, 0x03, // contrast? time?
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, // ???
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ???
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x10, // 0x10, 0x11, 0x12 -> lines
0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x11, // "
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, // "
};
dev = find_device();
if (!dev) die("cannot find device\n");
++argv; /* skip the program name */
poke_device(dev, packet, SIZE);
return 0;
}
--edit--
Further testing shows that this is the line that draws the top/bottom horizontal lines. So, what do the 0x10, 0x11, and 0x12 blocks do?
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
From
http://imonapi.tripod.com/#_Toc169965084 it indicates that the 0x01 byte is used to set/clear the icons. But in my case, 0x01 with all 0's seems to draw the horizontal lines.
--edit--
So I was mistaken... Testing more shows that the 0x01 command tells it to draw the "progress indicator" bars. The 0x10, 0x11, and 0x12 commands tell it what progress to draw. So the 0xff's in those lines instruct it to draw all the way across the screen, for the thinner of the two progress lines. If you set the rest to 0xff, you get both the thin and the thick progress bars drawn on the top and bottom.