USB input device question

Hi everyone

I have a problem getting USB input devices working in our embedded
system (MIPS, Au1500):

I try

devu-mouse &
devi-hirun msys fd -d/dev/usbmouse0 &

but no mouse cursor appears. (Photon is already started an shows phcalc)

I also tried

io-hid -dusb &
devi-hid mouse &

Here a mouse cursor appears, but no motion.

The same problem is with the USB keyboard, not even /dev/usbkbd0 exists
after starting devu-kbd.


USB is obviously working:

usb

USB (OHCI) v1.10, v1.01 DDK

Device Address : 1
Vendor : 0x03eb (Atmel)
Product : 0x3301 (Standard USB Hub)
Class : 0x09 (Hub)
Subclass : 0x00
Protocol : 0x00
Hub Number Ports : 4
Hub Characteristics : 0x0000 (Ganged power, Global over-current)
Hub Power On->Good : 100 ms
Hub Power Requirements : 64 mA

Device Address : 2
Vendor : 0x046a
Product : 0x0001
Class : 0x00 (Independant per interface)

Device Address : 3
Vendor : 0x046d (Logitech)
Product : 0xc001 (USB Mouse)
Class : 0x00 (Independant per interface)



Any idea?


Best Regards,
Joerg


Joerg Ritter Tel: +49 48 73 90 10 866
mycable GmbH Fax: +49 48 73 90 19 76
Boeker Stieg 43
D-24613 Aukrug eMail: jr@mycable.de

Joerg Ritter (jr@mycable.de) wrote:
: Hi everyone

: I have a problem getting USB input devices working in our embedded
: system (MIPS, Au1500):

: I try

: devu-mouse &
: devi-hirun msys fd -d/dev/usbmouse0 &

: but no mouse cursor appears. (Photon is already started an shows phcalc)

: I also tried

: io-hid -dusb &
: devi-hid mouse &


After you run “io-hid -dusb” can you run “hidview”
This will show you any installed HID devices.

If the device appears than run “hidview -a”
This will display any data coming from the device.




: Here a mouse cursor appears, but no motion.

: The same problem is with the USB keyboard, not even /dev/usbkbd0 exists
: after starting devu-kbd.


: USB is obviously working:

: # usb
: USB (OHCI) v1.10, v1.01 DDK

: Device Address : 1
: Vendor : 0x03eb (Atmel)
: Product : 0x3301 (Standard USB Hub)
: Class : 0x09 (Hub)
: Subclass : 0x00
: Protocol : 0x00
: Hub Number Ports : 4
: Hub Characteristics : 0x0000 (Ganged power, Global over-current)
: Hub Power On->Good : 100 ms
: Hub Power Requirements : 64 mA

: Device Address : 2
: Vendor : 0x046a
: Product : 0x0001
: Class : 0x00 (Independant per interface)

: Device Address : 3
: Vendor : 0x046d (Logitech)
: Product : 0xc001 (USB Mouse)
: Class : 0x00 (Independant per interface)



: Any idea?


: Best Regards,
: Joerg

: –

: -------------------------------------------------------
: Joerg Ritter Tel: +49 48 73 90 10 866
: mycable GmbH Fax: +49 48 73 90 19 76
: Boeker Stieg 43
: D-24613 Aukrug eMail: jr@mycable.de
: -------------------------------------------------------

Thanks,

hidview shows my keyboard (see below), or mouse.
But hidview -a doesn’t show anything, seems like it hangs.

What now?

Joerg


\

hidview

HIDD v1.00, v1.00 DDK

Device Address : 0
Vendor : 0x046a
Product : 0x0001
Version : r1.00
Usage : Keyboard


Process 81933 (hidview) exited status=0.

hidview -R

HIDD v1.00, v1.00 DDK

Device Address : 0
Vendor : 0x046a
Product : 0x0001
Version : r1.00
Usage : Keyboard
Report Information :
05 01 Usage Page(Generic Desktop)
09 06 Usage(Keyboard)
a1 01 Collection(Application)
05 07 Usage Page(Keyboard/Keypad)
19 e0 Usage Min(224)
29 e7 Usage Max(231)
15 00 Logical Min(0)
25 01 Logical Max(1)
75 01 Report Size(1)
95 08 Report Count(8)
81 02 Input(Data,Variable,Absoloute)
95 08 Report Count(8)
75 01 Report Size(1)
81 01 Input(Constant,Array,Absoloute)
05 08 Usage Page(LEDs)
19 01 Usage Min(1)
29 03 Usage Max(3)
95 03 Report Count(3)
75 01 Report Size(1)
91 02 Output(Data,Variable,Absoloute)
95 01 Report Count(1)
75 05 Report Size(5)
91 01 Output(Constant,Array,Absoloute)
05 07 Usage Page(Keyboard/Keypad)
19 00 Usage Min(0)
29 65 Usage Max(101)
15 00 Logical Min(0)
25 65 Logical Max(101)
95 06 Report Count(6)
75 08 Report Size(8)
81 00 Input(Data,Array,Absoloute)
c0 End Collection



Process 90125 (hidview) exited status=0.

hidview -r

HIDD v1.00, v1.00 DDK

Device Address : 0
Vendor : 0x046a
Product : 0x0001
Version : r1.00
Usage : Keyboard
Report Information :
05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01
75 01 95 08 81 02 95 08 75 01 81 01 05 08 19 01
29 03 95 03 75 01 91 02 95 01 75 05 91 01 05 07
19 00 29 65 15 00 25 65 95 06 75 08 81 00 c0





Henry Van Dyke wrote:

Joerg Ritter (> jr@mycable.de> ) wrote:
: Hi everyone

: I have a problem getting USB input devices working in our embedded
: system (MIPS, Au1500):

: I try

: devu-mouse &
: devi-hirun msys fd -d/dev/usbmouse0 &

: but no mouse cursor appears. (Photon is already started an shows phcalc)

: I also tried

: io-hid -dusb &
: devi-hid mouse &


After you run “io-hid -dusb” can you run “hidview”
This will show you any installed HID devices.

If the device appears than run “hidview -a”
This will display any data coming from the device.




: Here a mouse cursor appears, but no motion.

: The same problem is with the USB keyboard, not even /dev/usbkbd0 exists
: after starting devu-kbd.


: USB is obviously working:

: # usb
: USB (OHCI) v1.10, v1.01 DDK

: Device Address : 1
: Vendor : 0x03eb (Atmel)
: Product : 0x3301 (Standard USB Hub)
: Class : 0x09 (Hub)
: Subclass : 0x00
: Protocol : 0x00
: Hub Number Ports : 4
: Hub Characteristics : 0x0000 (Ganged power, Global over-current)
: Hub Power On->Good : 100 ms
: Hub Power Requirements : 64 mA

: Device Address : 2
: Vendor : 0x046a
: Product : 0x0001
: Class : 0x00 (Independant per interface)

: Device Address : 3
: Vendor : 0x046d (Logitech)
: Product : 0xc001 (USB Mouse)
: Class : 0x00 (Independant per interface)



: Any idea?


: Best Regards,
: Joerg

: –

: -------------------------------------------------------
: Joerg Ritter Tel: +49 48 73 90 10 866
: mycable GmbH Fax: +49 48 73 90 19 76
: Boeker Stieg 43
: D-24613 Aukrug eMail: > jr@mycable.de
: -------------------------------------------------------

Joerg Ritter (jr@mycable.de) wrote:
: Thanks,

: hidview shows my keyboard (see below), or mouse.
: But hidview -a doesn’t show anything, seems like it hangs.

Its waiting for data from the device.

Are the devices plugged through the hub ?
Does unplugging/plugging devices into the HUB work ?

Does the keyboard/mouse work ok on x86 ?

Can you run the USB stack with “devu-ohci -vvvvvvvvv”
Check the sloginfo output to see if any errors are reported.


: What now?

: Joerg



: # hidview
: HIDD v1.00, v1.00 DDK

: Device Address : 0
: Vendor : 0x046a
: Product : 0x0001
: Version : r1.00
: Usage : Keyboard


: Process 81933 (hidview) exited status=0.
: # hidview -R
: HIDD v1.00, v1.00 DDK

: Device Address : 0
: Vendor : 0x046a
: Product : 0x0001
: Version : r1.00
: Usage : Keyboard
: Report Information :
: 05 01 Usage Page(Generic Desktop)
: 09 06 Usage(Keyboard)
: a1 01 Collection(Application)
: 05 07 Usage Page(Keyboard/Keypad)
: 19 e0 Usage Min(224)
: 29 e7 Usage Max(231)
: 15 00 Logical Min(0)
: 25 01 Logical Max(1)
: 75 01 Report Size(1)
: 95 08 Report Count(8)
: 81 02 Input(Data,Variable,Absoloute)
: 95 08 Report Count(8)
: 75 01 Report Size(1)
: 81 01 Input(Constant,Array,Absoloute)
: 05 08 Usage Page(LEDs)
: 19 01 Usage Min(1)
: 29 03 Usage Max(3)
: 95 03 Report Count(3)
: 75 01 Report Size(1)
: 91 02 Output(Data,Variable,Absoloute)
: 95 01 Report Count(1)
: 75 05 Report Size(5)
: 91 01 Output(Constant,Array,Absoloute)
: 05 07 Usage Page(Keyboard/Keypad)
: 19 00 Usage Min(0)
: 29 65 Usage Max(101)
: 15 00 Logical Min(0)
: 25 65 Logical Max(101)
: 95 06 Report Count(6)
: 75 08 Report Size(8)
: 81 00 Input(Data,Array,Absoloute)
: c0 End Collection



: Process 90125 (hidview) exited status=0.
: # hidview -r
: HIDD v1.00, v1.00 DDK

: Device Address : 0
: Vendor : 0x046a
: Product : 0x0001
: Version : r1.00
: Usage : Keyboard
: Report Information :
: 05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01
: 75 01 95 08 81 02 95 08 75 01 81 01 05 08 19 01
: 29 03 95 03 75 01 91 02 95 01 75 05 91 01 05 07
: 19 00 29 65 15 00 25 65 95 06 75 08 81 00 c0





: Henry Van Dyke wrote:
: > Joerg Ritter (jr@mycable.de) wrote:
: > : Hi everyone
: >
: > : I have a problem getting USB input devices working in our embedded
: > : system (MIPS, Au1500):
: >
: > : I try
: >
: > : devu-mouse &
: > : devi-hirun msys fd -d/dev/usbmouse0 &
: >
: > : but no mouse cursor appears. (Photon is already started an shows phcalc)
: >
: > : I also tried
: >
: > : io-hid -dusb &
: > : devi-hid mouse &
: >
: >
: > After you run “io-hid -dusb” can you run “hidview”
: > This will show you any installed HID devices.
: >
: > If the device appears than run “hidview -a”
: > This will display any data coming from the device.
: >
: >
: >
: >
: > : Here a mouse cursor appears, but no motion.
: >
: > : The same problem is with the USB keyboard, not even /dev/usbkbd0 exists
: > : after starting devu-kbd.
: >
: >
: > : USB is obviously working:
: >
: > : # usb
: > : USB (OHCI) v1.10, v1.01 DDK
: >
: > : Device Address : 1
: > : Vendor : 0x03eb (Atmel)
: > : Product : 0x3301 (Standard USB Hub)
: > : Class : 0x09 (Hub)
: > : Subclass : 0x00
: > : Protocol : 0x00
: > : Hub Number Ports : 4
: > : Hub Characteristics : 0x0000 (Ganged power, Global over-current)
: > : Hub Power On->Good : 100 ms
: > : Hub Power Requirements : 64 mA
: >
: > : Device Address : 2
: > : Vendor : 0x046a
: > : Product : 0x0001
: > : Class : 0x00 (Independant per interface)
: >
: > : Device Address : 3
: > : Vendor : 0x046d (Logitech)
: > : Product : 0xc001 (USB Mouse)
: > : Class : 0x00 (Independant per interface)
: >
: >
: >
: > : Any idea?
: >
: >
: > : Best Regards,
: > : Joerg
: >
: > : –
: >
: > : -------------------------------------------------------
: > : Joerg Ritter Tel: +49 48 73 90 10 866
: > : mycable GmbH Fax: +49 48 73 90 19 76
: > : Boeker Stieg 43
: > : D-24613 Aukrug eMail: jr@mycable.de
: > : -------------------------------------------------------
: >

Henry Van Dyke wrote:

Joerg Ritter (> jr@mycable.de> ) wrote: : Thanks,

: hidview shows my keyboard (see below), or mouse. : But hidview -a
doesn’t show anything, seems like it hangs.

Its waiting for data from the device.

Are the devices plugged through the hub ?

doesn’t make any difference.

Does unplugging/plugging devices into the HUB work ?

yes, see sloginfo below

Does the keyboard/mouse work ok on x86 ?

I don’t know, we only use QNX on our embedded system (MIPS).



Can you run the USB stack with “devu-ohci -vvvvvvvvv” Check the
sloginfo output to see if any errors are reported.

Please see below. Apart from the beginning I think it looks ok, doesn’t it?

Another question:
What about devu-mouse and devu-kbd together with devi-hirun? Where is
the difference to io-hid and devi-hid?


Thanks,
Joerg

\

sloginfo

Time Sev Major Minor Args
Jan 01 00:00:01 2 12 0 CLASS_EnumerateDevice: parent 0, port
0, speed 1
Jan 01 00:00:01 2 12 0 CLASS_EnumerateDevice: Get device
descriptor
Jan 01 00:00:01 2 12 0 CLASS_EnumerateDevice: Get device
descriptor failed ffffffff
Jan 01 00:00:03 2 12 0 CLASS_EnumerateDevice: parent 0, port
0, speed 1
Jan 01 00:00:03 2 12 0 CLASS_EnumerateDevice: Get device
descriptor
Jan 01 00:00:03 2 12 0 CLASS_EnumerateDevice: Get device
descriptor failed ffffffff
Jan 01 00:00:04 2 12 0 CLASS_EnumerateDevice: parent 0, port
0, speed 1
Jan 01 00:00:04 2 12 0 CLASS_EnumerateDevice: Get device
descriptor
Jan 01 00:00:04 2 12 0 CLASS_EnumerateDevice: Get device
descriptor failed ffffffff
Jan 01 00:00:05 1 8 0 phfontXX started OK - EOK
Jan 01 00:00:05 1 8 0 MainLoop
Jan 01 00:00:07 2 8 0 unable to get path to config file
Jan 01 00:00:07 5 8 0 Plugin gri-photon.so opened successfully
Jan 01 00:00:07 5 8 0 Opened photon connection:
Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: parent 0, port
1, speed 1
Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: Get device
descriptor
Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: Set address 1
Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: Get full device
descriptor
Jan 01 00:25:35 2 12 0 CLASS_EnumerateDeviceConfiguration:
Get config descriptor
Jan 01 00:25:35 2 12 0 CLASS_EnumerateDeviceConfiguration:
Get full config descriptor
Jan 01 00:25:35 2 12 0 USB_SelectConfiguration: Set config
devno 1, cfg 1
Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: dno 1, vid 46d
Jan 01 00:28:20 2 12 0 CLASS_ExtractDevice: dno 1, vid 46d,
parent 0, port 1, openings 1
Jan 01 00:28:20 2 12 0 CLASS_ExtractDevice: holdoff parent 0,
port 1
Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: parent 0, port
1, speed 0
Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: Get device
descriptor
Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: Set address 2
Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: Get full device
descriptor
Jan 01 00:28:45 2 12 0 CLASS_EnumerateDeviceConfiguration:
Get config descriptor
Jan 01 00:28:45 2 12 0 CLASS_EnumerateDeviceConfiguration:
Get full config descriptor
Jan 01 00:28:45 2 12 0 USB_SelectConfiguration: Set config
devno 2, cfg 1
Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: dno 2, vid 3eb
Jan 01 00:29:06 2 12 0 CLASS_EnumerateDevice: parent 2, port
1, speed 1
Jan 01 00:29:06 2 12 0 CLASS_EnumerateDevice: Get device
descriptor
Jan 01 00:29:06 2 12 0 CLASS_EnumerateDevice: Set address 3
Jan 01 00:29:07 2 12 0 CLASS_EnumerateDevice: Get full device
descriptor
Jan 01 00:29:07 2 12 0 CLASS_EnumerateDeviceConfiguration:
Get config descriptor
Jan 01 00:29:07 2 12 0 CLASS_EnumerateDeviceConfiguration:
Get full config descriptor
Jan 01 00:29:07 2 12 0 USB_SelectConfiguration: Set config
devno 3, cfg 1
Jan 01 00:29:07 2 12 0 CLASS_EnumerateDevice: dno 3, vid 46d

: What now?

: Joerg


Joerg Ritter Tel: +49 48 73 90 10 866
mycable GmbH Fax: +49 48 73 90 19 76
Boeker Stieg 43
D-24613 Aukrug eMail: jr@mycable.de

Joerg Ritter (jr@mycable.de) wrote:
: Henry Van Dyke wrote:
: > Joerg Ritter (jr@mycable.de) wrote: : Thanks,
: >
: > : hidview shows my keyboard (see below), or mouse. : But hidview -a
: > doesn’t show anything, seems like it hangs.
: >
: > Its waiting for data from the device.
: >
: > Are the devices plugged through the hub ?

: doesn’t make any difference.

: > Does unplugging/plugging devices into the HUB work ?
: >

: yes, see sloginfo below


Ok. This means that the interrupt endpoint for the HUB is working.
Mouse and keyboard also use interrupt endpoints but the devices
don’t appear to be sending any data.

Since both devu-mouse and io-hid isn’t working the problem points
to the USB stack. We’ve tested here with a MIPS board and could
not reproduce this behaviour.

I may need to send you a version of the stack with some debug that
will show if any data is coming from the device.



: > Does the keyboard/mouse work ok on x86 ?
: >
: I don’t know, we only use QNX on our embedded system (MIPS).

: > Can you run the USB stack with “devu-ohci -vvvvvvvvv” Check the
: > sloginfo output to see if any errors are reported.
: >
: Please see below. Apart from the beginning I think it looks ok, doesn’t it?

: Another question:
: What about devu-mouse and devu-kbd together with devi-hirun? Where is
: the difference to io-hid and devi-hid?

io-hid/devi-hid is a new architecture being put in place to
better support USB input devices. USB HID devices can get quite complex
and completly describe themselves and the data they send. With io-hid
it will make it easier to write a single driver to manage simple and complex
devices. It also better supports the plug and play nature of the devices.


: Thanks,
: Joerg


: # sloginfo
: Time Sev Major Minor Args
: Jan 01 00:00:01 2 12 0 CLASS_EnumerateDevice: parent 0, port
: 0, speed 1
: Jan 01 00:00:01 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor
: Jan 01 00:00:01 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor failed ffffffff
: Jan 01 00:00:03 2 12 0 CLASS_EnumerateDevice: parent 0, port
: 0, speed 1
: Jan 01 00:00:03 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor
: Jan 01 00:00:03 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor failed ffffffff
: Jan 01 00:00:04 2 12 0 CLASS_EnumerateDevice: parent 0, port
: 0, speed 1
: Jan 01 00:00:04 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor
: Jan 01 00:00:04 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor failed ffffffff
: Jan 01 00:00:05 1 8 0 phfontXX started OK - EOK
: Jan 01 00:00:05 1 8 0 MainLoop
: Jan 01 00:00:07 2 8 0 unable to get path to config file
: Jan 01 00:00:07 5 8 0 Plugin gri-photon.so opened successfully
: Jan 01 00:00:07 5 8 0 Opened photon connection:
: Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: parent 0, port
: 1, speed 1
: Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor
: Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: Set address 1
: Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: Get full device
: descriptor
: Jan 01 00:25:35 2 12 0 CLASS_EnumerateDeviceConfiguration:
: Get config descriptor
: Jan 01 00:25:35 2 12 0 CLASS_EnumerateDeviceConfiguration:
: Get full config descriptor
: Jan 01 00:25:35 2 12 0 USB_SelectConfiguration: Set config
: devno 1, cfg 1
: Jan 01 00:25:35 2 12 0 CLASS_EnumerateDevice: dno 1, vid 46d
: Jan 01 00:28:20 2 12 0 CLASS_ExtractDevice: dno 1, vid 46d,
: parent 0, port 1, openings 1
: Jan 01 00:28:20 2 12 0 CLASS_ExtractDevice: holdoff parent 0,
: port 1
: Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: parent 0, port
: 1, speed 0
: Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor
: Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: Set address 2
: Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: Get full device
: descriptor
: Jan 01 00:28:45 2 12 0 CLASS_EnumerateDeviceConfiguration:
: Get config descriptor
: Jan 01 00:28:45 2 12 0 CLASS_EnumerateDeviceConfiguration:
: Get full config descriptor
: Jan 01 00:28:45 2 12 0 USB_SelectConfiguration: Set config
: devno 2, cfg 1
: Jan 01 00:28:45 2 12 0 CLASS_EnumerateDevice: dno 2, vid 3eb
: Jan 01 00:29:06 2 12 0 CLASS_EnumerateDevice: parent 2, port
: 1, speed 1
: Jan 01 00:29:06 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor
: Jan 01 00:29:06 2 12 0 CLASS_EnumerateDevice: Set address 3
: Jan 01 00:29:07 2 12 0 CLASS_EnumerateDevice: Get full device
: descriptor
: Jan 01 00:29:07 2 12 0 CLASS_EnumerateDeviceConfiguration:
: Get config descriptor
: Jan 01 00:29:07 2 12 0 CLASS_EnumerateDeviceConfiguration:
: Get full config descriptor
: Jan 01 00:29:07 2 12 0 USB_SelectConfiguration: Set config
: devno 3, cfg 1
: Jan 01 00:29:07 2 12 0 CLASS_EnumerateDevice: dno 3, vid 46d

: >
: > : What now?
: >
: > : Joerg


: –

: -------------------------------------------------------
: Joerg Ritter Tel: +49 48 73 90 10 866
: mycable GmbH Fax: +49 48 73 90 19 76
: Boeker Stieg 43
: D-24613 Aukrug eMail: jr@mycable.de
: -------------------------------------------------------

Henry Van Dyke wrote:

Joerg Ritter (> jr@mycable.de> ) wrote:
: Henry Van Dyke wrote:
: > Joerg Ritter (> jr@mycable.de> ) wrote: : Thanks,
:
: > : hidview shows my keyboard (see below), or mouse. : But hidview -a
: > doesn’t show anything, seems like it hangs.
:
: > Its waiting for data from the device.
:
: > Are the devices plugged through the hub ?

: doesn’t make any difference.

: > Does unplugging/plugging devices into the HUB work ?
:

: yes, see sloginfo below


Ok. This means that the interrupt endpoint for the HUB is working.
Mouse and keyboard also use interrupt endpoints but the devices
don’t appear to be sending any data.

Since both devu-mouse and io-hid isn’t working the problem points
to the USB stack. We’ve tested here with a MIPS board and could
not reproduce this behaviour.

I may need to send you a version of the stack with some debug that
will show if any data is coming from the device.


Any news about the debug version of the stack ?

/Joerg