9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] Huion, gaomon, &c tablets
@ 2023-02-10  0:16 adr
  0 siblings, 0 replies; only message in thread
From: adr @ 2023-02-10  0:16 UTC (permalink / raw)
  To: 9front

Hi,

these tablets (huion, gaomon, &c) are all the same under the hood, the
chipset is known as uclogic.  They don't conform hid, a report
descriptor has to be provided by the driver, as you did, but then the
parameters logical and physical maximum for x and y, and logical
maximum pressure have to be extracted from a string descriptor.  The
morons changed the string index where the settings are stored, first
was 100, then 200.  Some tablets has to be initialized by sending some
data, others are set to non-mobile mode just getting this string.
Take a look at the linux driver, it's pretty straightforward:


https://raw.githubusercontent.com/DIGImend/digimend-kernel-drivers/master/hid-uclogic-params.c

The idea is to try first the old way, check if it's ok, if not try the
new way and take into account particularities of some models.

In the other hand, I know my device's model string is in 0xc9, so what
the heck...

/sys/src/cmd/nusb/kb/kb.c:
==========================
[...]
#define UCLOGIC_XLM 49
#define UCLOGIC_XPM 54
#define UCLOGIC_YLM 63
#define UCLOGIC_YPM 68
#define UCLOGIC_PLM 80
static void
gaomons620(Hiddev *f)
{
[...]
//	static int idx[] = { 0x64, 0x65, 0x6e, 0x79, 0x7a, 0x7b, 0xc8, 0xc9 };
 	Dev *d = f->dev; 
//	int i;

//	/* we have to fetch a bunch of strings to switch to non-phone mode */
//	for(i=0; i < nelem(idx); i++)
//		free(loaddevstr(d, idx[i]));

 	model = loaddevstr(d, 0xc9);
 	if(strcmp("HUION_T176_190314", model) == 0){
 		/* fully-functional tablet mode */
 		free(loaddevstr(d, 0xc8));
 		descr[UCLOGIC_XLM] = 0x40;
 		descr[UCLOGIC_XLM+1] = 0x5f;
 		descr[UCLOGIC_XLM+2] = 0x00;
 		descr[UCLOGIC_XLM+3] = 0x00;
 		descr[UCLOGIC_XPM] = 0xc0;
 		descr[UCLOGIC_XPM+1] = 0x12;
 		descr[UCLOGIC_XPM+2] = 0x00;
 		descr[UCLOGIC_XPM+3] = 0x00;
 		descr[UCLOGIC_YLM] = 0x88;
 		descr[UCLOGIC_YLM+1] = 0x3b;
 		descr[UCLOGIC_YLM+2] = 0x00;
 		descr[UCLOGIC_YLM+3] = 0x00;
 		descr[UCLOGIC_YPM] = 0xb8;
 		descr[UCLOGIC_YPM+1] = 0x0b;
 		descr[UCLOGIC_YPM+2] = 0x00;
 		descr[UCLOGIC_YPM+3] = 0x00;
 		descr[UCLOGIC_PLM] = 0xff;
 		descr[UCLOGIC_PLM+1] = 0x1f;
 		descr[UCLOGIC_PLM+2] = 0x00;
 		descr[UCLOGIC_PLM+3] = 0x00;
 	}
 	free(model);
[...]

So my tablet is now in "fully-functional tablet mode" (that's what
they called it in the linux driver) and using all its surface (this
model is a bit bigger than the gaomons620).

You have two paths, include some code as in the linux driver, or make
a table with model string, x logical maximum, &c and possibly model
string index (I don't know if it is the same in all devices) and some
little functions to insert these values in little endian in f->rep.  The
pros and cons are obvious.

Regards,
adr

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-10  0:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10  0:16 [9front] Huion, gaomon, &c tablets adr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).